Generate excel upload template
public static void createTemplate(){
SysExcelWorksheetHelper worksheetHelper;
SysExcelHelper sysExcelHelper;
SysExcelWorksheet worksheet;
int currentRow = 1;
int column = 0;
int sumRow;
str worksheetName;
int redColor = WinAPI::RGB2int(255, 0, 0);
SysExcelRange range;
COMVariant cellValue = new COMVariant(COMVariantInOut::Out);
DictField field;
// Sets the font color for a range of cells
void setRangeFont(int _fromColumn, int _fromRow, int _toColumn, int _toRow, int _rgbIntColor)
{
range = worksheetHelper.getWorksheetRange(_fromColumn, _fromRow, _toColumn, _toRow);
worksheetHelper.setFontColor(range, _rgbIntColor);
}
worksheetName = 'customsheetname'';
sysExcelHelper = SysExcelHelper::construct();
sysExcelHelper.initialize();
worksheet = sysExcelHelper.addWorksheet(worksheetName);
worksheetHelper = SysExcelWorksheetHelper::construct(worksheet);
// Populate the header row with the appropriate field labels and format the columns
worksheetHelper.addColumn(1, 'Item', Types::String);
worksheetHelper.addColumn(2, 'Barcode', Types::String);
worksheetHelper.addColumn(3, 'Quantity', Types::Real);
worksheetHelper.addColumn(4, 'Order reference', Types::String);
worksheetHelper.addColumn(5, 'Serial number', Types::String);
worksheetHelper.addColumn(6, 'WareHose', Types::String);
worksheetHelper.addColumn(7, 'Location', Types::String);
worksheetHelper.autoFitColumns();
worksheetHelper.formatWorksheetTableStyle(sysExcelHelper.getOfficeVersion());
sysExcelHelper.launchExcel();
}
No comments:
Post a Comment