// Generates content of worksheetPart1. private void GenerateWorksheetPart1Content(WorksheetPart worksheetPart1) { Worksheet worksheet1 = new Worksheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; worksheet1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); worksheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); worksheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); SheetDimension sheetDimension1 = new SheetDimension() { Reference = "A1" }; SheetViews sheetViews1 = new SheetViews(); SheetView sheetView1 = new SheetView() { WorkbookViewId = (UInt32Value)0U }; Selection selection1 = new Selection() { ActiveCell = "O9", SequenceOfReferences = new ListValue<StringValue>() { InnerText = "O9" } }; sheetView1.Append(selection1); sheetViews1.Append(sheetView1); SheetFormatProperties sheetFormatProperties1 = new SheetFormatProperties() { DefaultRowHeight = 15D, DyDescent = 0.25D }; SheetData sheetData1 = new SheetData(); Row row1 = new Row() { RowIndex = (UInt32Value)1U, Spans = new ListValue<StringValue>() { InnerText = "1:1" }, DyDescent = 0.25D }; Cell cell1 = new Cell() { CellReference = "A1", DataType = CellValues.SharedString }; CellValue cellValue1 = new CellValue(); cellValue1.Text = "2"; cell1.Append(cellValue1); row1.Append(cell1); sheetData1.Append(row1); PageMargins pageMargins1 = new PageMargins() { Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D }; S.Drawing drawing1 = new S.Drawing() { Id = "rId1" }; worksheet1.Append(sheetDimension1); worksheet1.Append(sheetViews1); worksheet1.Append(sheetFormatProperties1); worksheet1.Append(sheetData1); worksheet1.Append(pageMargins1); worksheet1.Append(drawing1); worksheetPart1.Worksheet = worksheet1; }
// Generates content of worksheetPart2. private void GenerateWorksheetPart2Content(WorksheetPart worksheetPart2) { Worksheet worksheet2 = new Worksheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; worksheet2.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); worksheet2.AddNamespaceDeclaration("xdr", "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"); worksheet2.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); worksheet2.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); worksheet2.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); SheetDimension sheetDimension2 = new SheetDimension() { Reference = "A1:V19" }; SheetViews sheetViews2 = new SheetViews(); SheetView sheetView2 = new SheetView() { TabSelected = true, WorkbookViewId = (UInt32Value)0U }; Selection selection2 = new Selection() { ActiveCell = "X5", SequenceOfReferences = new ListValue<StringValue>() { InnerText = "X5" } }; sheetView2.Append(selection2); sheetViews2.Append(sheetView2); SheetFormatProperties sheetFormatProperties2 = new SheetFormatProperties() { DefaultRowHeight = 15D, DyDescent = 0.25D }; SheetData sheetData2 = new SheetData(); Row row2 = new Row() { RowIndex = (UInt32Value)1U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell2 = new Cell() { CellReference = "A1" }; CellValue cellValue2 = new CellValue(); cellValue2.Text = "1"; cell2.Append(cellValue2); Cell cell3 = new Cell() { CellReference = "C1", StyleIndex = (UInt32Value)1U, DataType = CellValues.SharedString }; CellValue cellValue3 = new CellValue(); cellValue3.Text = "0"; cell3.Append(cellValue3); row2.Append(cell2); row2.Append(cell3); Row row3 = new Row() { RowIndex = (UInt32Value)2U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell4 = new Cell() { CellReference = "A2" }; CellValue cellValue4 = new CellValue(); cellValue4.Text = "2"; cell4.Append(cellValue4); row3.Append(cell4); Row row4 = new Row() { RowIndex = (UInt32Value)3U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell5 = new Cell() { CellReference = "A3" }; CellValue cellValue5 = new CellValue(); cellValue5.Text = "3"; cell5.Append(cellValue5); row4.Append(cell5); Row row5 = new Row() { RowIndex = (UInt32Value)4U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, Height = 135D, DyDescent = 0.25D }; Cell cell6 = new Cell() { CellReference = "A4" }; CellValue cellValue6 = new CellValue(); cellValue6.Text = "4"; cell6.Append(cellValue6); Cell cell7 = new Cell() { CellReference = "C4", StyleIndex = (UInt32Value)2U, DataType = CellValues.SharedString }; CellValue cellValue7 = new CellValue(); cellValue7.Text = "1"; cell7.Append(cellValue7); row5.Append(cell6); row5.Append(cell7); Row row6 = new Row() { RowIndex = (UInt32Value)5U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell8 = new Cell() { CellReference = "A5" }; CellValue cellValue8 = new CellValue(); cellValue8.Text = "5"; cell8.Append(cellValue8); Cell cell9 = new Cell() { CellReference = "Q5", StyleIndex = (UInt32Value)3U, DataType = CellValues.SharedString }; CellValue cellValue9 = new CellValue(); cellValue9.Text = "6"; cell9.Append(cellValue9); Cell cell10 = new Cell() { CellReference = "T5" }; CellValue cellValue10 = new CellValue(); cellValue10.Text = "4"; cell10.Append(cellValue10); row6.Append(cell8); row6.Append(cell9); row6.Append(cell10); Row row7 = new Row() { RowIndex = (UInt32Value)6U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell11 = new Cell() { CellReference = "A6" }; CellFormula cellFormula1 = new CellFormula(); cellFormula1.Text = "SUM(A1:A5)"; CellValue cellValue11 = new CellValue(); cellValue11.Text = "15"; cell11.Append(cellFormula1); cell11.Append(cellValue11); Cell cell12 = new Cell() { CellReference = "T6" }; CellValue cellValue12 = new CellValue(); cellValue12.Text = "7"; cell12.Append(cellValue12); row7.Append(cell11); row7.Append(cell12); Row row8 = new Row() { RowIndex = (UInt32Value)7U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell13 = new Cell() { CellReference = "T7" }; CellValue cellValue13 = new CellValue(); cellValue13.Text = "6"; cell13.Append(cellValue13); row8.Append(cell13); Row row9 = new Row() { RowIndex = (UInt32Value)8U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell14 = new Cell() { CellReference = "T8" }; CellValue cellValue14 = new CellValue(); cellValue14.Text = "5"; cell14.Append(cellValue14); row9.Append(cell14); Row row10 = new Row() { RowIndex = (UInt32Value)9U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell15 = new Cell() { CellReference = "T9" }; CellValue cellValue15 = new CellValue(); cellValue15.Text = "4"; cell15.Append(cellValue15); row10.Append(cell15); Row row11 = new Row() { RowIndex = (UInt32Value)10U, Spans = new ListValue<StringValue>() { InnerText = "1:22" }, DyDescent = 0.25D }; Cell cell16 = new Cell() { CellReference = "T10" }; CellValue cellValue16 = new CellValue(); cellValue16.Text = "7"; cell16.Append(cellValue16); row11.Append(cell16); Row row12 = new Row() { RowIndex = (UInt32Value)17U, Spans = new ListValue<StringValue>() { InnerText = "1:3" }, DyDescent = 0.25D }; Cell cell17 = new Cell() { CellReference = "A17", DataType = CellValues.SharedString }; CellValue cellValue17 = new CellValue(); cellValue17.Text = "3"; cell17.Append(cellValue17); Cell cell18 = new Cell() { CellReference = "B17", DataType = CellValues.SharedString }; CellValue cellValue18 = new CellValue(); cellValue18.Text = "4"; cell18.Append(cellValue18); Cell cell19 = new Cell() { CellReference = "C17", DataType = CellValues.SharedString }; CellValue cellValue19 = new CellValue(); cellValue19.Text = "5"; cell19.Append(cellValue19); row12.Append(cell17); row12.Append(cell18); row12.Append(cell19); Row row13 = new Row() { RowIndex = (UInt32Value)18U, Spans = new ListValue<StringValue>() { InnerText = "1:3" }, DyDescent = 0.25D }; Cell cell20 = new Cell() { CellReference = "A18" }; CellValue cellValue20 = new CellValue(); cellValue20.Text = "1"; cell20.Append(cellValue20); Cell cell21 = new Cell() { CellReference = "B18" }; CellValue cellValue21 = new CellValue(); cellValue21.Text = "2"; cell21.Append(cellValue21); Cell cell22 = new Cell() { CellReference = "C18" }; CellValue cellValue22 = new CellValue(); cellValue22.Text = "3"; cell22.Append(cellValue22); row13.Append(cell20); row13.Append(cell21); row13.Append(cell22); Row row14 = new Row() { RowIndex = (UInt32Value)19U, Spans = new ListValue<StringValue>() { InnerText = "1:3" }, DyDescent = 0.25D }; Cell cell23 = new Cell() { CellReference = "A19" }; CellValue cellValue23 = new CellValue(); cellValue23.Text = "4"; cell23.Append(cellValue23); Cell cell24 = new Cell() { CellReference = "B19" }; CellValue cellValue24 = new CellValue(); cellValue24.Text = "5"; cell24.Append(cellValue24); Cell cell25 = new Cell() { CellReference = "C19" }; CellValue cellValue25 = new CellValue(); cellValue25.Text = "6"; cell25.Append(cellValue25); row14.Append(cell23); row14.Append(cell24); row14.Append(cell25); sheetData2.Append(row2); sheetData2.Append(row3); sheetData2.Append(row4); sheetData2.Append(row5); sheetData2.Append(row6); sheetData2.Append(row7); sheetData2.Append(row8); sheetData2.Append(row9); sheetData2.Append(row10); sheetData2.Append(row11); sheetData2.Append(row12); sheetData2.Append(row13); sheetData2.Append(row14); Hyperlinks hyperlinks1 = new Hyperlinks(); Hyperlink hyperlink2 = new Hyperlink() { Reference = "Q5", Id = "rId1" }; hyperlinks1.Append(hyperlink2); PageMargins pageMargins2 = new PageMargins() { Left = 0.25D, Right = 0.25D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D }; PageSetup pageSetup1 = new PageSetup() { Orientation = OrientationValues.Landscape, HorizontalDpi = (UInt32Value)4294967293U, VerticalDpi = (UInt32Value)0U, Id = "rId2" }; S.Drawing drawing3 = new S.Drawing() { Id = "rId3" }; LegacyDrawing legacyDrawing1 = new LegacyDrawing() { Id = "rId4" }; TableParts tableParts1 = new TableParts() { Count = (UInt32Value)1U }; TablePart tablePart1 = new TablePart() { Id = "rId5" }; tableParts1.Append(tablePart1); worksheet2.Append(sheetDimension2); worksheet2.Append(sheetViews2); worksheet2.Append(sheetFormatProperties2); worksheet2.Append(sheetData2); worksheet2.Append(hyperlinks1); worksheet2.Append(pageMargins2); worksheet2.Append(pageSetup1); worksheet2.Append(drawing3); worksheet2.Append(legacyDrawing1); worksheet2.Append(tableParts1); worksheetPart2.Worksheet = worksheet2; }