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 TouchToneTommy 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
May 28, 2009
1
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