For the fpsopendocument.pas it's here:
procedure TsSpreadOpenDocWriter.WriteWorksheet(AStream: TStream;
ASheetIndex: Integer);
begin
FWorksheet := FWorkbook.GetWorksheetByIndex(ASheetIndex);
// Header
AppendToStream(AStream, Format(
'<table:table table:name="%s" table:style-name="ta%d">', [
FWorkSheet.Name, ASheetIndex+1
]));
// columns
WriteColumns(AStream, FWorkSheet);
// rows and cells
// The cells need to be written in order, row by row, cell by cell
if (boVirtualMode in Workbook.Options) then
begin
if Assigned(Workbook.OnWriteCellData) then
WriteVirtualCells(AStream, FWorksheet)
end else
WriteRowsAndCells(AStream, FWorksheet);
// Footer
AppendToStream(AStream,
'</table:table>');
end;
Like I showed in the previous post the print-range is an attribute of table:table.
<office:body>
<office:spreadsheet>
<table:table table:name="Sheet1" table:style-name="ta1" table:print-ranges="Sheet1.A2:Sheet1.C2">
<table:table-column table:style-name="co1" table:default-cell-style-name="Default"/>
(So adding table:print-ranges="Sheet1.A2:Sheet1.C2" to the table:table part)
This is a per worksheet-setting so a PrintRange-property as string could be added where the user could put A2:C2 as range, or something. I haven't tested if the worksheet-name needs to be in there but OpenOffice does save it there. Also... in OpenOffice it's possible to define multiple ranges. Not sure yet how that is presented in the content.xml.
Edit: Multiple ranges are separated by a space in the content.xml. So Ranges could be a TStringList or something.
<table:table table:name="Sheet1" table:style-name="ta1" table:print-ranges="Sheet1.A2:Sheet1.C2 Sheet1.A2:Sheet1.A2 Sheet1.B4:Sheet1.C6">
I haven't dismembered xlsx yet to see where it's defined there.