I'd do that like this // Output to Excel, 09.06.05, sela // 1. forming data in HTML // 2. then copy the HTML into clipboard // 3. then from clipboard to Excel static void fromHtml2xl() { COM application; COM document; COM workBooks; COMVariant temlateName; COM activeSheet; COM range;
TextBuffer textBuffer; UserInfo userInfo; str strHtml; ; strHtml = "<html><head></head>" + "<body>\n" + "<table border=2>" + "<tr bgcolor=#ff0000><td colspan=2><b>Header</b></td></tr>"; strHtml += "<tr bgcolor=#c7c7c7><td align=left>Name</td><td lign=right>Company</td></tr>"; while select userInfo { strHtml += "<tr bgcolor=#ff00ff><td align=left>" + strfmt("% 1",userInfo.Name) + "</td>"; strHtml += "<td lign=right>" + strfmt("%1",userInfo.Company) + "</td></tr>"; } strHtml +="</table>" + "</body>" + "</html>"; try { application = new COM("Excel.Application"); application.visible(false); temlateName = new COMVariant(COMVariantInOut::IN, COMVariantType::VT_I4); temlateName.long(-4167); workBooks = application.workBooks(); document = workBooks.add(temlateName); temlateName.finalize(); workBooks.finalize(); activeSheet = document.activeSheet(); textBuffer = new TextBuffer(); //rus(); textBuffer.appendText(strHtml); textBuffer.toClipboard(); activeSheet.paste(); range = application.range("A1"); range.select(); application.visible(true); } catch (Exception::Error) { } catch(Exception::Internal) { } } --- In Axapta-Knowledge-Village@yahoogroups.com, vishnu verma <[EMAIL PROTECTED]> wrote: > hi johannes, > There are 2 ways to convert Axapta data into Excel format. > 1)First u can give the file format to HTML and u'll have to give the extension of the file name .xls.Then u'll get a excell file on HTML background.Copy this data and paste into a new excel file.This will solve ur problem. > > 2)You can give the extension of the file name .xls and let the file format be ASCII.It'll give u the excel file on excel background but in a hapazered manner.It'll create the problem in distinguish the field values with field name. > So u can use both methods. > Vishnu > > > slees32 <[EMAIL PROTECTED]> wrote: > Hello, > > There was a reply to this about using html with a .xls extension. I > cannot find that post. But wanted to ask a question. > > It was a great solution. > > But when the document is opened in excel, the default background > grid does not exist. So you just have a white background and cannot > see the cells. > I cannot find any way to reinstate this default background. > Is it possible. > > > Thankyou - Steve > > > --- In Axapta-Knowledge-Village@yahoogroups.com, "Opitz Johannes" > <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I want to export Data from Axapta into an formatted Microsoft > Excel file. I know that there are several COM - Objects but i am not > sure if there is enough functionallity to realise my problems. > > > > Does anybody know where i can find a tutorial or a documentation > about it ? > > > > mit freundlichen Grüßen/kind regards > > Johannes Opitz > > > > TeleTEK > > Telekommunikation-Service GmbH & Co KG > > Eitnergasse 6 > > A-1230 Wien > > > > > > Fax +43-1-866 49 188 > > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > www.teletek.at <http://www.teletek.at/> > > > > > > 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 the Yahoo! Terms of Service. > > > > --------------------------------- > Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for FREE! > http://in.mail.yahoo.com ------------------------ Yahoo! Groups Sponsor --------------------~--> What would our lives be like without music, dance, and theater? Donate or volunteer in the arts today at Network for Good! http://us.click.yahoo.com/Tcy2bD/SOnJAA/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/