Hi,
Thank you for your answer, indeed, when I try to print directly from code, the problem doesn't exist, but when I open the document from Microsoft Excel, it doesn't keep the configuration.
When I open the document, in titlesPrint menu, the field 'Rows to repeat at top' appears empty despite "$1:$9".
- Code: Select all
static private void generateExcel()
{
Workbook excel = new Workbook();
Worksheet full = excel.Worksheets[0];
full.PageSetup.Orientation = PageOrientationType.Landscape;
full.PageSetup.PrintTitleRows = "$1:$9";
for (int i =1;i<50;i++)
{
full.Range[i, 1].Value = i.ToString();
}
excel.SaveToFile(@"c:\test\PrintTitleRow15687.xlsx", FileFormat.Version2013);
excel.PrintDocument.PrinterSettings.DefaultPageSettings.Landscape = true;
//print excel
//excel.PrintDocument.Print();
}
I found a difference between the document that Spire.Xls generates and the document that Microsoft generates. The difference I found is in the line
<definedName name="Print_Titles" localSheetId="0">'Sheet1'!$1:$9</definedName> there are two single quotes.
I have attached xml code for checking the difference. I don't know if this is the problem, but I hope to help to find the solution.
Thank you for helping