Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML for Print Title in Excel

Status
Not open for further replies.

xmlshadow

IS-IT--Management
Joined
May 28, 2009
Messages
1
Location
US
So i'm exporting to an excel sheet using C# and xml. I am able to succefully export correctly. The only problem I have is that I don't know how to program the "Rows to repeat on top" using XML. Here is my code:

("<head>\n");
sb.Append("<style>\n");
sb.Append("@page");
sb.Append("{size:14.0in 8.5in;margin:.5in .75in .5in .75in;\n");
sb.Append("mso-header-margin:.5in;\n");
sb.Append("mso-footer-margin:.5in;\n");
sb.Append("mso-page-orientation:landscape;}\n");

sb.Append("@print");
sb.Append("{mso-print-title-row: $8:$8;}\n");

sb.Append("</style>\n");

sb.Append("<!--[if gte mso 9]><xml>\n");
sb.Append("<x:ExcelWorkbook>\n");

sb.Append("<x:ExcelWorksheets>\n");
sb.Append("<x:ExcelWorksheet>\n");
sb.Append("<x:Name>"+Month+"</x:Name>\n");
sb.Append("<x:WorksheetOptions>\n");

sb.Append("<x:Print>\n");
sb.Append("<x:ValidPrinterInfo/>\n");

sb.Append("<x:PaperSizeIndex>5</x:PaperSizeIndex>\n");
sb.Append("<x:HorizontalResolution>600</x:HorizontalResolution\n");

sb.Append("<x:VerticalResolution>600</x:VerticalResolution\n");
sb.Append("</x:Print>\n");

sb.Append("<x:Selected/>\n");
sb.Append("<x:DoNotDisplayGridlines/>\n");

sb.Append("<x:ProtectContents>False</x:ProtectContents>\n");
sb.Append("<x:ProtectObjects>False</x:ProtectObjects>\n");

sb.Append("<x:ProtectScenarios>False</x:ProtectScenarios>\n");
sb.Append("</x:WorksheetOptions>\n");

sb.Append("</x:ExcelWorksheet>\n");
sb.Append("</x:ExcelWorksheets>\n");

sb.Append("<x:WindowHeight>12780</x:WindowHeight>\n");
sb.Append("<x:WindowWidth>19035</x:WindowWidth>\n");

sb.Append("<x:WindowTopX>0</x:WindowTopX>\n");
sb.Append("<x:WindowTopY>15</x:WindowTopY>\n");

sb.Append("<x:ProtectStructure>False</x:ProtectStructure>\n");
sb.Append("<x:ProtectWindows>False</x:ProtectWindows>\n");

sb.Append("</x:ExcelWorkbook>\n");

sb.Append("</xml><![endif]-->\n");

sb.Append("</head>\n");


I have tried using "mso-print-title-row: $8:$8" as you saw above but it doesn't work. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top