Hi charles,
try this.
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');
}
/Jesper
Original Message processed by Tobit InfoCenter Subject:RE: [development-axapta] Creating Excel with X++ (29-Jan-2004 9:36) From:[EMAIL PROTECTED] To:[EMAIL PROTECTED] Hi Asknes,Thanks for the suggestion. I'll give it a try.-----Original Message-----
From: Aksnes Eva [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 29, 2004 4:20 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [development-axapta] Creating Excel with X++Is template a possibility?This is how you make a new file based on a template:static void Excel(Args _args)
{
SysExcelApplication sysExcelApplication;
SysExcelWorkbooks sysExcelWorkbooks;
SysExcelWorkbook sysExcelWorkbook;
SysExcelWorksheet sysExcelWorksheet;
SysExcelRange sysExcelRange;
COM range;
COM characters;COMVariant COMVariant;
;sysExcelApplication = SysExcelApplication::construct();
sysExcelApplication.visible(true);
sysExcelWorkbooks = sysExcelApplication.workbooks();
COMVariant = new COMVariant();
COMVariant.bStr(<templateFilename>);
sysExcelWorkbook = sysExcelWorkbooks.add(COMVariant);
sysExcelWorksheet = sysExcelApplication.activeSheet();
sysExcelRange = sysExcelWorksheet.range('A1');
range = sysExcelRange.comObject();
characters = range.characters(1);
characters.insert('Test');}-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 29. januar 2004 08:41
To: [EMAIL PROTECTED]
Subject: RE: [development-axapta] Creating Excel with X++Hi Aknes,Do you know how I can add in formatting to individual cells? For example changing the color, font type/style etc.-----Original Message-----
From: Aksnes Eva [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 29, 2004 3:27 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [development-axapta] Creating Excel with X++Ex: A simple job. Puts 'Test' in A1 (Not sure the bookmark is set correctly, but still..)static void Excel(Args _args)
{
SysExcelApplication sysExcelApplication;
SysExcelWorkbooks sysExcelWorkbooks;
SysExcelWorkbook sysExcelWorkbook;
SysExcelWorksheet sysExcelWorksheet;
SysExcelRange sysExcelRange;
COM range;
COM characters;
;sysExcelApplication = SysExcelApplication::construct();
sysExcelApplication.visible(true);
sysExcelWorkbooks = sysExcelApplication.workbooks();
sysExcelWorkbook = sysExcelWorkbooks.add();
sysExcelWorksheet = sysExcelApplication.activeSheet();
sysExcelRange = sysExcelWorksheet.range('A1');
range = sysExcelRange.comObject();
characters = range.characters(1);
characters.insert('Test');}-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 29. januar 2004 04:28
To: [EMAIL PROTECTED]
Subject: [development-axapta] Creating Excel with X++Hi all,I hope to learn more about creating excel worksheets using X++. I am familiar with creating worksheets and populating cells with values. However I wish to know more about using styles or other formating features available.There isn't much information I could get on the Axapta Developer Guide. I have also tried looking at existing classes that creates excel such as the SysExcelTemplateWizard class, but it doesn't provide much help.I would appreciate very much if you could share any resources with me on this or could point me to places that provide such information.TIA,Charles
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

