[SOLVED] Headers and PageBreak simultaneously lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- rca · 2025-07-26 04:42 I'm attaching a simple example of PageLayout.Headers with AddPageBreakToRow. Basically, what I'm doing is: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   MyDir := ExtractFilePath(ParamStr(0));   sWorksheetGrid1.Worksheet.PageLayout.HeaderMargin := 10;  sWorksheetGrid1.Worksheet.Pagelayout.TopMargin := 30;  sWorksheetGrid1.Worksheet.PageLayout.Headers[HEADER_FOOTER_INDEX_ALL] := '&CHeader test';   sWorksheetGrid1.Cells[1,1] := 'Page 1';  sWorksheetGrid1.Cells[1,2] := 'Page 2';   sWorksheetGrid1.Worksheet.AddPageBreakToRow(1);   sWorksheetGrid1.Workbook.WriteToFile(MyDir + 'headertest.xlsx', sfOOXML, true); After saving the "headertest.xlsx" file, when I try to open it with Excel, I get an error message about the file contents... If I use AddPageBreakToRow or PageLayout.Headers separately, they work, but not simultaneously. I appreciate any help you can give me. ---------------------------------------------------------------------- wp · 2025-07-26 09:08 It seems that the node must be after the node in the xml file of the xlsx. Only Microsoft knows why... Please update your FPSpreadsheet from the svn repository. ---------------------------------------------------------------------- rca · 2025-07-26 11:59 @wp I updated to the latest version and it works fine now. Thank you so much for your help. Excellent work!