Hi, This job can be used in data migration when your client asks for a template of a particular table.
static void Wipfli_TemplateGenerator(Args _args)
{
SysExcelWorksheetHelper worksheetHelper;
SysExcelHelper sysExcelHelper;
SysExcelWorksheet worksheet;
int column = 1;
int row = 1;
str worksheetName;
SysDictField dictField;
SysExcelCell excelCell;
int redColor = WinAPI::RGB2int(255, 0, 0);
SysExcelRange range;
COMVariant cellValue = new COMVariant(COMVariantInOut::Out);
DictTable DictTable;
int fieldCount, _x, fieldId,enumValues, enumValue;
sysExcelHelper = SysExcelHelper::construct();
sysExcelHelper.initialize();
worksheet = sysExcelHelper.addWorksheet("Template");
worksheetHelper = SysExcelWorksheetHelper::construct(worksheet);
DictTable = new DictTable(tableNum(InventTable));// Use your table name here.
fieldCount = DictTable.fieldCnt();
fieldId = DictTable.fieldNext(0);
while (fieldId)
{
DictField = DictTable.fieldObject(fieldId);
worksheetHelper.addColumn(column, dictField.name(),Types::AnyType);
fieldId = DictTable.fieldNext(fieldId);
column++;
}
sysExcelHelper.launchExcel();
}
static void Wipfli_TemplateGenerator(Args _args)
{
SysExcelWorksheetHelper worksheetHelper;
SysExcelHelper sysExcelHelper;
SysExcelWorksheet worksheet;
int column = 1;
int row = 1;
str worksheetName;
SysDictField dictField;
SysExcelCell excelCell;
int redColor = WinAPI::RGB2int(255, 0, 0);
SysExcelRange range;
COMVariant cellValue = new COMVariant(COMVariantInOut::Out);
DictTable DictTable;
int fieldCount, _x, fieldId,enumValues, enumValue;
sysExcelHelper = SysExcelHelper::construct();
sysExcelHelper.initialize();
worksheet = sysExcelHelper.addWorksheet("Template");
worksheetHelper = SysExcelWorksheetHelper::construct(worksheet);
DictTable = new DictTable(tableNum(InventTable));// Use your table name here.
fieldCount = DictTable.fieldCnt();
fieldId = DictTable.fieldNext(0);
while (fieldId)
{
DictField = DictTable.fieldObject(fieldId);
worksheetHelper.addColumn(column, dictField.name(),Types::AnyType);
fieldId = DictTable.fieldNext(fieldId);
column++;
}
sysExcelHelper.launchExcel();
}
Good Post !!!!
ReplyDelete