ใช้ Axata ออกรายงาน ExcelCode :static void ExcelFormating(Args _args){ #Excel SysExcelApplication excel; SysExcelWorkbooks books; SysExcelWorkbook book; SysExcelWorksheet sheet; SysExcelRange range; SysExcelStyles styles; SysExcelStyle style; SysExcelInterior interior; SysExcelFont font; COM _char, _r; ; excel = SysExcelApplication::construct(); excel.visible(true); books = excel.workbooks(); book = books.add(); sheet = excel.activeSheet(); range = sheet.range('A1'); styles = book.styles(); style = styles.add('MyStyle'); interior = style.interior(); interior.color(WinApi::RGB2int(246, 233, 206)); font = style.font(); font.bold(true); font.color(winapi::RGB2int(153, 204, 255)); range.style('MyStyle'); range.locked(true); _r = range.comObject(); _char = _r.characters(1); _char.insert('MyStyle');}
เช่น
SysExcelApplication SysExcelApplication; SysExcelWorksheet SysExcelWorksheet; SysExcelWorksheets SysExcelWorksheets; SysExcelWorkbooks SysExcelWorkbooks; SysExcelWorkbook SysExcelWorkbook; SysExcelRange SysExcelRange; SysExcelCell SysExcelCell; SysExcelCells SysExcelCells; COMVariant COMVariant1; #excel
;
sysExcelApplication = SysExcelApplication::construct(); sysExcelApplication.visible(false); sysExcelWorkbooks = sysExcelApplication.workbooks(); COMVariant1 = new COMVariant();
\\ ที่อยู่ของไฟล์ต้นฉบับ COMVariant1.bStr('\\\\Axaptaserver\\AxaptaSP4\\Excel\\InvoiceSCI.xls'); sysExcelWorkbook = sysExcelWorkbooks.add(COMVariant1); SysExcelWorksheets = sysExcelWorkbook.worksheets(); SysExcelWorksheet = SysExcelWorksheets.itemFromNum(1); SysExcelRange = SysExcelWorksheet.cells().range(#ExcelTotalRange);
SysExcelCell = SysExcelWorksheet.cells().item(i,1); SysExcelCell.value(custInvoiceJour.InvoiceDate);
select * from custtrans where custtrans.Invoice == custInvoiceJour.InvoiceId; SysExcelCell = SysExcelWorksheet.cells().item(i,2); SysExcelCell.value(custtrans.InvoiceNumber);
SysExcelApplication SysExcelApplication;
SysExcelWorksheet SysExcelWorksheet;
SysExcelWorksheets SysExcelWorksheets;
SysExcelWorkbooks SysExcelWorkbooks;
SysExcelWorkbook SysExcelWorkbook;
SysExcelRange SysExcelRange;
SysExcelCell SysExcelCell;
SysExcelCells SysExcelCells;
COMVariant COMVariant1;
#excel
;
sysExcelApplication = SysExcelApplication::construct();
sysExcelApplication.visible(false);
sysExcelWorkbooks = sysExcelApplication.workbooks();
COMVariant1 = new COMVariant();
\\ ที่อยู่ของไฟล์ต้นฉบับ
COMVariant1.bStr('\\\\Axaptaserver\\AxaptaSP4\\Excel\\InvoiceSCI.xls');
sysExcelWorkbook = sysExcelWorkbooks.add(COMVariant1);
SysExcelWorksheets = sysExcelWorkbook.worksheets();
SysExcelWorksheet = SysExcelWorksheets.itemFromNum(1);
SysExcelRange = SysExcelWorksheet.cells().range(#ExcelTotalRange);
SysExcelCell = SysExcelWorksheet.cells().item(i,1);
SysExcelCell.value(custInvoiceJour.InvoiceDate);
select * from custtrans where custtrans.Invoice == custInvoiceJour.InvoiceId;
SysExcelCell = SysExcelWorksheet.cells().item(i,2);
SysExcelCell.value(custtrans.InvoiceNumber);
No comments:
Post a Comment