Hi Friends,
The below code which was working good for excel export but i need sheet wise
set print preview and pages as landscape set.
any one please help me on this...
public static string getWorkbookTemplate()
{
StringBuilder sb = new StringBuilder(818);
sb.AppendFormat(@"<?xml version=""1.0""?>{0}", Environment.NewLine);
sb.AppendFormat(@"<?mso-application progid=""Excel.Sheet""?>{0}", Environment.NewLine);
sb.AppendFormat(@"<Workbook xmlns=""urn:schemas-microsoft-com:office:spreadsheet""{0}", Environment.NewLine);
sb.AppendFormat(@" xmlns:o=""urn:schemas-microsoft-com:office:office""{0}", Environment.NewLine);
sb.AppendFormat(@" xmlns:x=""urn:schemas-microsoft-com:office:excel""{0}", Environment.NewLine);
sb.AppendFormat(@" xmlns:ss=""urn:schemas-microsoft-com:office:spreadsheet""{0}", Environment.NewLine);
sb.AppendFormat(@" xmlns:html=""http://www.w3.org/TR/REC-html40"">{0}", Environment.NewLine);
sb.AppendFormat(@" <Styles>{0}", Environment.NewLine);
sb.AppendFormat(@" <Style ss:ID=""Default"" ss:Name=""Normal"">{0}", Environment.NewLine);
sb.AppendFormat(@" <Alignment ss:Vertical=""Bottom""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Borders/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Font ss:FontName=""Times New Roman"" x:Family=""Swiss"" ss:Size=""10"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Interior/>{0}", Environment.NewLine);
sb.AppendFormat(@" <NumberFormat/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Protection/>{0}", Environment.NewLine);
sb.AppendFormat(@" </Style>{0}", Environment.NewLine);
sb.AppendFormat(@" <Style ss:ID=""s62"">{0}", Environment.NewLine);
sb.AppendFormat(@" <Alignment ss:Horizontal=""Left"" ss:Vertical=""Top"" ss:ReadingOrder=""LeftToRight""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Borders>{0}", Environment.NewLine);
sb.AppendFormat(@" <Border ss:Position=""Bottom"" ss:LineStyle=""Continuous"" ss:Weight=""1"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Border ss:Position=""Left"" ss:LineStyle=""Continuous"" ss:Weight=""1"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Border ss:Position=""Right"" ss:LineStyle=""Continuous"" ss:Weight=""1"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Border ss:Position=""Top"" ss:LineStyle=""Continuous"" ss:Weight=""1"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" </Borders>{0}", Environment.NewLine);
sb.AppendFormat(@" <Font x:CharSet=""1"" ss:Size=""10"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Interior ss:Color=""#D8D8D8"" ss:Pattern=""Solid""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <page ss:PageOrientation=""landscape"" />{0}", Environment.NewLine);
sb.AppendFormat(@" </Style>{0}", Environment.NewLine);
sb.AppendFormat(@" <Style ss:ID=""s63"">{0}", Environment.NewLine);
sb.AppendFormat(@" <NumberFormat ss:Format=""Short Date""/>{0}", Environment.NewLine);
sb.AppendFormat(@" </Style>{0}", Environment.NewLine);
sb.AppendFormat(@" <Style ss:ID=""s22"">{0}", Environment.NewLine);
sb.AppendFormat(@" <Borders>{0}", Environment.NewLine);
sb.AppendFormat(@" <Border ss:Position=""Bottom"" ss:LineStyle=""Continuous"" ss:Weight=""1"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Border ss:Position=""Left"" ss:LineStyle=""Continuous"" ss:Weight=""1"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Border ss:Position=""Right"" ss:LineStyle=""Continuous"" ss:Weight=""1"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Border ss:Position=""Top"" ss:LineStyle=""Continuous"" ss:Weight=""1"" ss:Color=""#000000""/>{0}", Environment.NewLine);
sb.AppendFormat(@" </Borders>{0}", Environment.NewLine);
sb.AppendFormat(@" <page ss:PageOrientation=""landscape"" />{0}", Environment.NewLine);
sb.AppendFormat(@" </Style>{0}", Environment.NewLine);
sb.AppendFormat(@" </Styles>{0}", Environment.NewLine);
sb.AppendFormat(@" <WorksheetOptions>{0}", Environment.NewLine);
sb.AppendFormat(@" <FitToPage/>{0}", Environment.NewLine);
sb.AppendFormat(@" <Print x:FitWidth=""1"" x:FitHeight=""1000"" x:ValidPrinterInfo=""""/>{0}", Environment.NewLine);
sb.AppendFormat(@" </WorksheetOptions>{0}", Environment.NewLine);
sb.Append(@"{0}\r\n</Workbook>");
return sb.ToString();
}