Andrew,
Creating a spreadsheet with a “header” line and multiple “Detail” lines is very doable using the functions in the Excel Buffer table - table ID 370.
There is a sample of how to do this on MIBUSO - here’s the link:
http://www.mibuso.com/dlinfo.asp?FileID=596
Or search for “Demo of Excel buffer usage” on the "Downloads page.
That example shows how to export single records, but I have used this technique to create header/line exports. Create the export report (this technique uses Report objects, not dataports or xmlports) with multiple dataitems. Include a “Record Type” field so on the import you can tell if the record being read is a header or line. For example, here’s a code snippet. The header in this case is “Issue” (our bug tracking system) and the detail lines are objects that were corrected for the issue. For the header section, the first column is the character “H”:
RowNo := RowNo + 1;
ColNo := 1;
EnterCell(RowNo, ColNo, ‘H’, ‘’, FALSE);
ColNo := ColNo + 1;
EnterCell(RowNo, ColNo, “Issue”.“No.”, ‘’, FALSE);
ColNo := ColNo + 1;
EnterCell(RowNo, ColNo, “Issue”.Description, ‘’, FALSE);
ColNo := ColNo + 1;
EnterCell(RowNo, ColNo, “Issue”.“Lead Developer”, ‘’, FALSE);
ColNo := ColNo + 1;
EnterCell(RowNo, ColNo, FORMAT(“Issue”.“Dev Completed”), ‘’, FALSE);
ColNo := ColNo + 1;
Then, a second indented dataitem for the objects included in the issue has this code. The first column is the character “L”
RowNo := RowNo + 1;
ColNo := 1;
EnterCell(RowNo, ColNo, ‘L’, ‘’, FALSE);
ColNo := ColNo + 1;
EnterCell(RowNo, ColNo, “Issue Object”.“Issue No.”, ‘’, FALSE);
ColNo := ColNo + 1;
EnterCell(RowNo, ColNo, FORMAT(“Issue Object”.Type), ‘’, FALSE);
ColNo := ColNo + 1;
EnterCell(RowNo, ColNo, FORMAT(“Issue Object”.ID), ‘’, FALSE);
ColNo := ColNo + 1;
The resulting excel file looks something like this:
H Issue01 Remove Restrictions on Pick Ron Yes
L Issue01 Table 50066
L Issue01 Form 50118
L Issue01 Report 50054
L Issue01 Report 50228
L Issue01 Codeunit 50013
L Issue01 Page 50118