21.12.2007, 04:11 | #1 |
Участник
|
axStart: Office Com Integration
Источник: http://axstart.spaces.live.com/Blog/...C0A0!208.entry
============== Some people find it hard to write integration with Office. Well it is not as hard as you expect. In below scripts are some examples shown. static void ExampleExcel(Args _args) { SysExcelApplication excel; SysExcelWorkbooks books; SysExcelWorkbook book; SysExcelWorksheets sheets; SysExcelWorksheet sheet; SysExcelCells cells; SysExcelCell cell; ; excel = SysExcelApplication::construct(); books = excel.workbooks(); book = books.add(); sheets = excel.worksheets(); sheet = sheets.itemFromNum(1); sheet.name("My Sheet"); cells = sheet.cells(); cell = cells.item(1,1); cell.value(1000); cell = cells.item(2,1); cell.value(500); cell = cells.item(3,1); cell.value('=SUM(A1,A2)'); excel.visible(true); } static void ExampleWord(Args _args) { COM wordApplication; COM wordDocuments; COM wordDocument; COM wordRange; ; wordApplication = new COM("word.application"); wordApplication.visible(TRUE); wordDocuments = wordApplication.Documents(); wordDocument = wordDocuments.add(); wordDocument.saveas("c:\Axapta COM Document1.doc"); wordDocument.activate(); wordRange = wordDocument.range(0,0); wordRange.insertafter("Hello from Axapta."); wordRange.bold(true); wordDocument.save(); wordDocument.close(); wordApplication.quit(); } static void ExampleOutlook(Args _args) { COM outLookAppl; COM newTask; //Initialize the com outlook object outLookAppl = new com("OutLook.application"); //Creates and task object newTask = outLookAppl.CreateItem(3); newTask.subject("Approve requisition"); newTask.startDate(systemDateGet()+1); newTask.dueDate(systemDateGet()+3); //In progress newTask.status("1"); //Initiate reminder newTask.ReminderSet(true); //Play sounds when reminders needs to be send newTask.ReminderPlaySound("True"); //Default reminder sound is chosen newTask.ReminderOverrideDefault("false"); newTask.body("Requisition RQ2003 ready for approval."); newTask.categories("Requisition"); newTask.totalWork("2"); //Display the new task to screen newTask.display(); } Источник: http://axstart.spaces.live.com/Blog/...C0A0!208.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|