Try this: > <http://www.navision.net/forum/topic.asp?TOPIC_ID=11002> > > NOTE 1- it expects an image named c:temphello.bmp to exist. > NOTE 2- Be careful debugging this stuff, if execution is discontinued and > comWorkBooks.close() and comApplication.quit() are not called, > you will need to manually kill the EXCEL.EXE process in the task manager. > > COM comApplication; > COM comWorkbooks; > COM comWorkbook; > COM comWorksheet; > COM comShapes; > > COMVariant variant = new COMVariant(); > COMVariant xpos = new COMVariant(); > COMVariant ypos = new COMVariant(); > COMVariant state = new COMVariant(); > COMVariant width = new COMVariant(); > COMVariant height = new COMVariant(); > > SysExcelWorksheet excelWorksheet; > SysExcelCells excelCells; > ; > > //Create the Excel app and grab the workbooks > comApplication = new COM('Excel.application'); > comWorkBooks = comApplication.workbooks(); > > //Wrap the rest in an exception to make sure excel is closed > try > { > //Create a new workbook and get a reference to it > variant.int(-4167); > comWorkBook = comWorkBooks.add(variant); > comWorkSheet = comApplication.activeSheet(); > //Add some text to the worksheet > excelWorksheet = SysExcelWorkSheet::construct(MSOfficeVersion::Office2000, > comWorksheet); > excelCells = excelWorksheet.cells(); > excelCells.item(10,1).value("Hello world"); > > //Set up image parameters > variant.bStr("c:\temp\hello.bmp"); > xpos.int(1); > ypos.int(1); > state.int(1); > width.int(100); > height.int(100); > //Add the image to the worksheet > comShapes = comWorkSheet.shapes(); > comShapes.addPicture(variant,xpos,ypos,state,state,width,height); > > //Autofitt and protect the sheet > excelworksheet.columns().autoFit(); > excelWorksheet.protect('',true,true); > > //Save the sheet and close the app > comWorkBook.saveas("c:\\temp\\hello.xls"); > comWorkBooks.close(); > comApplication.quit(); > } > catch(Exception::Error) > { > //Force app to quit > comWorkBook.saveas("c:\\temp\\hello.xls"); > comWorkBooks.close(); > comApplication.quit(); > } > > > > > -----Original Message----- > From: Ramakrishnan [SMTP:[EMAIL PROTECTED] > Sent: February 9, 2005 2:55 AM > To: Axapta-Knowledge-Village@yahoogroups.com > Subject: [Axapta-Knowledge-Village] Images to Excel > > > > Hi, > > Does anyone know how to put images (GIF/JPG) format to Excel sheet > through x++ code in Axapta? > > If anyone knows pls reply. > > Thanks. > > Ramki. > > > > > > > Sharing the knowledge on Axapta. > Yahoo! Groups Links > > > > > > ---------------------------------- This communication, including its attachments, if any, is intended solely for the recipient; it is confidential and may contain personal or private information, or proprietary and/or privileged material. As such, any unauthorized use, retention, copying, disclosure or other distribution of this communication, or the taking of any action in reliance on its contents is strictly prohibited. If you have received this communication in error, please notify us immediately and delete this communication (and any attachments.)
------------------------ Yahoo! Groups Sponsor --------------------~--> Has someone you know been affected by illness or disease? Network for Good is THE place to support health awareness efforts! http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/kGEolB/TM --------------------------------------------------------------------~-> Sharing the knowledge on Axapta. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/Axapta-Knowledge-Village/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/