This article describes the specifics of spreadsheet document header and footer operations performed from 1C:Enterprise script.
Header and footer operations
When a spreadsheet document is output to an empty spreadsheet document, its headers and footers are output to the target document. So if you need to set headers or footers from 1C:Enteprise script, do it after outputting the entire report or after outputting at least one its area.
Correct:
FormItems.SpreadsheetDocumentField.Clear();
ReportBuilderReport.Put(FormItems.SpreadsheetDocumentField);
FormItems.SpreadsheetDocumentField.Footer.Enabled = True;
FormItems.SpreadsheetDocumentField.Footer.CenterText = "[&PageNumber] out of [&PagesTotal]";
Incorrect:
FormItems.SpreadsheetDocumentField.Clear(); FormItems.SpreadsheetDocumentField.Footer.Enabled = True; FormItems.SpreadsheetDocumentField.Footer.CenterText = "[&PageNumber] out of [&PagesTotal]"; ReportBuilderReport.Put(FormItems.SpreadsheetDocumentField);
Alternatively, you can specify headers and footers in the report template, either in the visual editor or from 1C:Enterprise script(prior to using the template).
Example:
ReportBuilderReport.Template = ExternalDataProcessorObject.GetTemplate("Report");
ReportBuilderReport.Template.Footer.Enabled = True;
ReportBuilderReport.Template.Footer.CenterText = "[&PageNumber] out of [&PagesTotal]";
FormItems.SpreadsheetDocumentField.Clear();
ReportBuilderReport.Put(FormItems.SpreadsheetDocumentField);
Next page: Optimizing forms that comply with legislation requirements