Excel-add multi sheets

csimoneaux
Member Posts: 168
I am trying to add new sheet for each Company...
I have taken the standard Fixed asset report and customized it to look at every company and bring back all data for all companies.
Data Item
Company
Fixed asset.
On the Report - OnPostReport() I have added the following.
IF PrintDetail THEN BEGIN
TmpExcelBuffer.CreateBook;
TmpExcelBuffer.CreateSheet('FixedAsset','Fixed Asset Book Value 01',COMPANYNAME,USERID);
TmpExcelBuffer.GiveUserControl;
END;
Every time the Company changes I need the data to print to another sheet until it reaches the next company, which in turn should create another sheet.
There are 26 companies in Total.
Would someone be able to help me figure out how to do this. I see data on how to create new sheet, But I can not figure out where to put code to create sheet when Company changes.
I have taken the standard Fixed asset report and customized it to look at every company and bring back all data for all companies.
Data Item
Company
Fixed asset.
On the Report - OnPostReport() I have added the following.
IF PrintDetail THEN BEGIN
TmpExcelBuffer.CreateBook;
TmpExcelBuffer.CreateSheet('FixedAsset','Fixed Asset Book Value 01',COMPANYNAME,USERID);
TmpExcelBuffer.GiveUserControl;
END;
Every time the Company changes I need the data to print to another sheet until it reaches the next company, which in turn should create another sheet.
There are 26 companies in Total.
Would someone be able to help me figure out how to do this. I see data on how to create new sheet, But I can not figure out where to put code to create sheet when Company changes.
0
Comments
-
You could try setting the sheet name to the company name each time you change company, then do the
TmpExcelBuffer.CreateSheet(SheetName,'Fixed Asset Book Value 01',COMPANYNAME,USERID);
prior to getting the next company.
You will have to do the createbook before this.0 -
If I create new sheets for each company on Report - OnPostReport(), How do I tell what data goes to what sheet.
Report - OnPostReport runs after all data has been put into the ExcelBuffer Table.
Did I miss something here?0 -
Yes you need to do it before the onPostReport, where you have modified the report to swap Companies. I cannot tell where this is because I don't know how you've customised the report, and the solution will in some respects depend on how this was done.
Essentially,
1 create book
2 get data for 1st company
3 create sheet for 1st company
4 repeat 2 and 3 for other companies
5 give user control
But as I say will in part be determined how you modified the report.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions