Axapta : Job LibreOffice Copy Sheet
ตัวอย่าง
- static void CopySheetOffice(Args _args)
- {
- // ----------- OpenOffice -----------
- COM OpenOffice;
- COM oDeskTop;
- COM oDocument;
- COM oSheets;
- COM oSheet;
- COM oRange;
- COM BorderStruct;
- COMVariant arg;
- COMVariant byte;
- Array Arr = new Array(Types::Class);
- Array oArr = new Array(Types::Class);
- str url;
- str outFile;
- COM FileProperties;
- // ----------- TABLE -----------
- CustTable custTable;
- // ----------- VARIABLE -----------
- int rows = 1;
- int sheet = 2;
- ///##### Function Print Trans #####//
- void printTrans(){
- rows++;
- oRange = oSheet.getCellByPosition(0, rows);
- oRange.SetString("123456");
- }
- ;
- // ##### Open template file ######
- url = strfmt("%1%2", templatePath(), "/IV/ItemNotTransferByDate.ods");
- OpenOffice = new Com("com.sun.star.ServiceManager");
- oDeskTop = OpenOffice.CreateInstance("com.sun.star.frame.Desktop");
- arg = COMVariant::createFromArray(arr);
- oDocument = oDeskTop.LoadComponentFromURL(url, "_blank", 0, arg);
- oSheets = oDocument.getSheets();
- oSheet = oSheets.getByIndex(0);
- BorderStruct = OpenOffice.Bridge_GetStruct('com.sun.star.table.BorderLine');
- BorderStruct.Color(24567057);
- BorderStruct.LineDistance(0);
- BorderStruct.InnerLineWidth(0);
- BorderStruct.OuterLineWidth(1);
- // ##### Save as temp file ######
- DeleteFilesInFolder("C:/AxaptaSP4/Temp/IV/");
- outFile = strfmt("file:///C:/AxaptaSP4/Temp/IV/ItemNotTransferByDate-%1.ods", timenow());
- oDocument.storeAsURL(outFile, arg);
- // #######################################################################################
- WHILE
- SELECT AccountNum FROM custTable
- ORDER BY Name
- WHERE custTable.CustGroup == "AUD"
- {
- oSheets.CopyByName("Template", custTable.AccountNum, sheet);
- oSheet = oSheets.getByIndex(sheet);
- printTrans();
- rows = 1;
- sheet++;
- }//Close While.
- }
No comments:
Post a Comment