//..................................................................... /// <summary> /// /// </summary> /// <param name="wbookpart"></param> private void GenerateWorkBook(WorkbookPart wbookpart) { Workbook workbook1 = new Workbook( ); workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); FileVersion fileVersion1 = new FileVersion( ) { ApplicationName = "xl", LastEdited = "5", LowestEdited = "5", BuildVersion = "9303" }; WorkbookProperties workbookProperties1 = new WorkbookProperties( ) { DefaultThemeVersion = ( UInt32Value )124226U }; BookViews bookViews1 = new BookViews( ); WorkbookView workbookView1 = new WorkbookView( ) { XWindow = 0, YWindow = 45, WindowWidth = ( UInt32Value )15075U, WindowHeight = ( UInt32Value )4680U }; bookViews1.Append(workbookView1); //............................................. Sheets sheets1 = new Sheets( ); Sheet sheet1 = new Sheet( ) { Name = "Sheet1", SheetId = ( UInt32Value )1U, Id = "rId1" }; Sheet sheet2 = new Sheet( ) { Name = "Sheet2", SheetId = ( UInt32Value )2U, Id = "rId2" }; Sheet sheet3 = new Sheet( ) { Name = "Sheet3", SheetId = ( UInt32Value )3U, Id = "rId3" }; sheets1.Append(sheet1); sheets1.Append(sheet2); sheets1.Append(sheet3); //............................................. CalculationProperties calculationProperties1 = new CalculationProperties( ) { CalculationId = ( UInt32Value )145621U }; workbook1.Append(fileVersion1); workbook1.Append(workbookProperties1); workbook1.Append(bookViews1); workbook1.Append(sheets1); workbook1.Append(calculationProperties1); wbookpart.Workbook = workbook1; return; }
public void TestDeserialize() { using (var stream = new MemoryStream()) { var excel = new ExcelSerializer(); var wb = TestData.CreateWorkbookProperties(); excel.Serialize(stream, TestData.ArrayOfModels, wb); stream.Flush(); stream.Position = 0; var wb2 = new WorkbookProperties(); var results = excel.Deserialize(stream, wb2); var page1 = TestData.ArrayOfModels[0].OfType <DataModel>(); var page2 = TestData.ArrayOfModels[1].OfType <DataModel2>(); var result1 = results[0].OfType <DataModel>(); var result2 = results[1].OfType <DataModel2>(); Assert.IsTrue(page1.SequenceEqual(result1), "Serialize/Deserialize round trip"); Assert.IsTrue(page2.SequenceEqual(result2), "Serialize/Deserialize round trip"); } }
private static void GenerateWorkbookPartContent(WorkbookPart workbookPart) { Workbook workbook = new Workbook() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x15" } }; workbook.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); workbook.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); workbook.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); FileVersion fileVersion = new FileVersion() { ApplicationName = "xl", LastEdited = "6", LowestEdited = "4", BuildVersion = "14420" }; WorkbookProperties workbookProperties = new WorkbookProperties() { FilterPrivacy = true, DefaultThemeVersion = (UInt32Value)124226U }; BookViews bookViews = new BookViews(); WorkbookView workbookView = new WorkbookView() { XWindow = 240, YWindow = 105, WindowWidth = (UInt32Value)14805U, WindowHeight = (UInt32Value)8010U }; bookViews.Append(workbookView); Sheets sheets = new Sheets(); Sheet sheet = new Sheet() { Name = "Лист1", SheetId = (UInt32Value)1U, Id = "rId1" }; sheets.Append(sheet); CalculationProperties calculationProperties = new CalculationProperties() { CalculationId = (UInt32Value)152511U, ForceFullCalculation = true, FullCalculationOnLoad = true }; workbook.Append(fileVersion); workbook.Append(workbookProperties); workbook.Append(bookViews); workbook.Append(sheets); workbook.Append(calculationProperties); workbookPart.Workbook = workbook; }
private static IList <IList> TestReadExcel() { var wbProps = new WorkbookProperties(); var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\TestWriteExcel.xlsx"; using (var fs = new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite | FileShare.Delete)) { var xls = new ExcelSerializer(); var result = xls.Deserialize(fs, wbProps); var test = result[0].Cast <DataModel>().ToArray(); return(result); } }
public void TestDeserialize() { using (var stream = new MemoryStream()) { var excel = new ExcelAssignment(); var wb = TestData.CreateWorkbookProperties(); excel.Serialize(stream, TestData.AssignmentData, "Worksheet Tab Name", wb); stream.Flush(); stream.Position = 0; var wb2 = new WorkbookProperties(); string[,] result = excel.Deserialize(stream, wb2); stream.Position = 0; Assert.IsTrue(result == null, "Serialize/Deserialize Assignment round trip"); ChangeExcelValues(stream); wb2 = new WorkbookProperties(); result = excel.Deserialize(stream, wb2); Assert.IsTrue(result[2, 3] == "O", "Removed Assignment"); Assert.IsTrue(result[2, 4] == "X", "Added Assignment"); } }
// Generates content of workbookPart1. private void GenerateWorkbookPart1Content(WorkbookPart workbookPart1) { Workbook workbook1 = new Workbook(); workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); FileVersion fileVersion1 = new FileVersion() { ApplicationName = "xl", LastEdited = "4", LowestEdited = "4", BuildVersion = "4506" }; WorkbookProperties workbookProperties1 = new WorkbookProperties() { DefaultThemeVersion = (UInt32Value)124226U }; BookViews bookViews1 = new BookViews(); WorkbookView workbookView1 = new WorkbookView() { XWindow = 360, YWindow = 150, WindowWidth = (UInt32Value)14355U, WindowHeight = (UInt32Value)4680U }; bookViews1.Append(workbookView1); Sheets sheets1 = new Sheets(); Sheet sheet1 = new Sheet() { Name = "Sheet1", SheetId = (UInt32Value)1U, Id = "rId1" }; sheets1.Append(sheet1); CalculationProperties calculationProperties1 = new CalculationProperties() { CalculationId = (UInt32Value)125725U }; workbook1.Append(fileVersion1); workbook1.Append(workbookProperties1); workbook1.Append(bookViews1); workbook1.Append(sheets1); workbook1.Append(calculationProperties1); workbookPart1.Workbook = workbook1; }
internal WorkbookProperties ToWorkbookProperties() { WorkbookProperties wp = new WorkbookProperties(); if (this.bDate1904 != null) { wp.Date1904 = this.bDate1904.Value; } if (this.bDateCompatibility != null) { wp.DateCompatibility = this.bDateCompatibility.Value; } if (this.vShowObjects != null) { wp.ShowObjects = this.vShowObjects.Value; } if (this.bShowBorderUnselectedTables != null) { wp.ShowBorderUnselectedTables = this.bShowBorderUnselectedTables.Value; } if (this.bFilterPrivacy != null) { wp.FilterPrivacy = this.bFilterPrivacy.Value; } if (this.bPromptedSolutions != null) { wp.PromptedSolutions = this.bPromptedSolutions.Value; } if (this.bShowInkAnnotation != null) { wp.ShowInkAnnotation = this.bShowInkAnnotation.Value; } if (this.bBackupFile != null) { wp.BackupFile = this.bBackupFile.Value; } if (this.bSaveExternalLinkValues != null) { wp.SaveExternalLinkValues = this.bSaveExternalLinkValues.Value; } if (this.vUpdateLinks != null) { wp.UpdateLinks = this.vUpdateLinks.Value; } if (this.sCodeName != null) { wp.CodeName = this.sCodeName; } if (this.bHidePivotFieldList != null) { wp.HidePivotFieldList = this.bHidePivotFieldList.Value; } if (this.bShowPivotChartFilter != null) { wp.ShowPivotChartFilter = this.bShowPivotChartFilter.Value; } if (this.bAllowRefreshQuery != null) { wp.AllowRefreshQuery = this.bAllowRefreshQuery.Value; } if (this.bPublishItems != null) { wp.PublishItems = this.bPublishItems.Value; } if (this.bCheckCompatibility != null) { wp.CheckCompatibility = this.bCheckCompatibility.Value; } if (this.bAutoCompressPictures != null) { wp.AutoCompressPictures = this.bAutoCompressPictures.Value; } if (this.bRefreshAllConnections != null) { wp.RefreshAllConnections = this.bRefreshAllConnections.Value; } if (this.iDefaultThemeVersion != null) { wp.DefaultThemeVersion = this.iDefaultThemeVersion.Value; } return(wp); }
internal void FromWorkbookProperties(WorkbookProperties wp) { this.SetAllNull(); if (wp.Date1904 != null) { this.Date1904 = wp.Date1904.Value; } if (wp.DateCompatibility != null) { this.DateCompatibility = wp.DateCompatibility.Value; } if (wp.ShowObjects != null) { this.ShowObjects = wp.ShowObjects.Value; } if (wp.ShowBorderUnselectedTables != null) { this.ShowBorderUnselectedTables = wp.ShowBorderUnselectedTables.Value; } if (wp.FilterPrivacy != null) { this.FilterPrivacy = wp.FilterPrivacy.Value; } if (wp.PromptedSolutions != null) { this.PromptedSolutions = wp.PromptedSolutions.Value; } if (wp.ShowInkAnnotation != null) { this.ShowInkAnnotation = wp.ShowInkAnnotation.Value; } if (wp.BackupFile != null) { this.BackupFile = wp.BackupFile.Value; } if (wp.SaveExternalLinkValues != null) { this.SaveExternalLinkValues = wp.SaveExternalLinkValues.Value; } if (wp.UpdateLinks != null) { this.UpdateLinks = wp.UpdateLinks.Value; } if (wp.CodeName != null) { this.CodeName = wp.CodeName.Value; } if (wp.HidePivotFieldList != null) { this.HidePivotFieldList = wp.HidePivotFieldList.Value; } if (wp.ShowPivotChartFilter != null) { this.ShowPivotChartFilter = wp.ShowPivotChartFilter.Value; } if (wp.AllowRefreshQuery != null) { this.AllowRefreshQuery = wp.AllowRefreshQuery.Value; } if (wp.PublishItems != null) { this.PublishItems = wp.PublishItems.Value; } if (wp.CheckCompatibility != null) { this.CheckCompatibility = wp.CheckCompatibility.Value; } if (wp.AutoCompressPictures != null) { this.AutoCompressPictures = wp.AutoCompressPictures.Value; } if (wp.RefreshAllConnections != null) { this.RefreshAllConnections = wp.RefreshAllConnections.Value; } if (wp.DefaultThemeVersion != null) { this.DefaultThemeVersion = wp.DefaultThemeVersion.Value; } }
// Generates content of workbookPart1. private void GenerateWorkbookPart1Content(WorkbookPart workbookPart1) { Workbook workbook1 = new Workbook(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x15" } }; workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); workbook1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); workbook1.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); FileVersion fileVersion1 = new FileVersion(){ ApplicationName = "xl", LastEdited = "6", LowestEdited = "6", BuildVersion = "14420" }; WorkbookProperties workbookProperties1 = new WorkbookProperties(){ CodeName = "ThisWorkbook", DefaultThemeVersion = (UInt32Value)153222U }; AlternateContent alternateContent1 = new AlternateContent(); alternateContent1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); AlternateContentChoice alternateContentChoice1 = new AlternateContentChoice(){ Requires = "x15" }; X15ac.AbsolutePath absolutePath1 = new X15ac.AbsolutePath(){ Url = "D:\\Users\\dito\\Desktop\\TestDocumentResaver\\OpenXmlApiConversion\\Pivot\\" }; absolutePath1.AddNamespaceDeclaration("x15ac", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"); alternateContentChoice1.Append(absolutePath1); alternateContent1.Append(alternateContentChoice1); BookViews bookViews1 = new BookViews(); WorkbookView workbookView1 = new WorkbookView(){ XWindow = 0, YWindow = 0, WindowWidth = (UInt32Value)26940U, WindowHeight = (UInt32Value)15120U }; bookViews1.Append(workbookView1); Sheets sheets1 = new Sheets(); Sheet sheet1 = new Sheet(){ Name = "Sheet1", SheetId = (UInt32Value)1U, Id = "rId1" }; sheets1.Append(sheet1); DefinedNames definedNames1 = new DefinedNames(); DefinedName definedName1 = new DefinedName(){ Name = "Query", LocalSheetId = (UInt32Value)0U, Hidden = true }; definedName1.Text = "Sheet1!$B$2:$I$13"; definedNames1.Append(definedName1); CalculationProperties calculationProperties1 = new CalculationProperties(){ CalculationId = (UInt32Value)152511U }; PivotCaches pivotCaches1 = new PivotCaches(); PivotCache pivotCache1 = new PivotCache(){ CacheId = (UInt32Value)0U, Id = "rId2" }; pivotCaches1.Append(pivotCache1); WorkbookExtensionList workbookExtensionList1 = new WorkbookExtensionList(); WorkbookExtension workbookExtension1 = new WorkbookExtension(){ Uri = "{FCE2AD5D-F65C-4FA6-A056-5C36A1767C68}" }; workbookExtension1.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.DataModel dataModel1 = new X15.DataModel(); X15.ModelTables modelTables1 = new X15.ModelTables(); X15.ModelTable modelTable1 = new X15.ModelTable(){ Id = "Query_7c41ad89-7105-4c9f-ab5a-881bd3e6a1b9", Name = "Query", Connection = "DAT105 Timestamp - Foodmart 2000 account" }; modelTables1.Append(modelTable1); dataModel1.Append(modelTables1); workbookExtension1.Append(dataModel1); WorkbookExtension workbookExtension2 = new WorkbookExtension(){ Uri = "{69C81A23-63F3-4edf-8378-127667AE99B5}" }; OpenXmlUnknownElement openXmlUnknownElement1 = OpenXmlUnknownElement.CreateOpenXmlUnknownElement("<x15:workbookPr15 chartTrackingRefBase=\"1\" xmlns:x15=\"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main\" />"); workbookExtension2.Append(openXmlUnknownElement1); workbookExtensionList1.Append(workbookExtension1); workbookExtensionList1.Append(workbookExtension2); workbook1.Append(fileVersion1); workbook1.Append(workbookProperties1); workbook1.Append(alternateContent1); workbook1.Append(bookViews1); workbook1.Append(sheets1); workbook1.Append(definedNames1); workbook1.Append(calculationProperties1); workbook1.Append(pivotCaches1); workbook1.Append(workbookExtensionList1); workbookPart1.Workbook = workbook1; }
private void generateWorkbookPartContent(WorkbookPart workbookPart) { var workbook = new Workbook(); workbook.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); var fileVersion = new FileVersion { ApplicationName = "xl", LastEdited = "5", LowestEdited = "5", BuildVersion = "9303" }; var workbookProperties = new WorkbookProperties { DefaultThemeVersion = 124226 }; var bookViews = new BookViews(); var workbookView = new WorkbookView { XWindow = 630, YWindow = 600, WindowWidth = 27495, WindowHeight = 11955 }; bookViews.Append(workbookView); var sheets = new Sheets(); var sheet = new Sheet { Name = "Документ", SheetId = 1, Id = "rId1" }; sheets.Append(sheet); var calculationProperties = new CalculationProperties { CalculationId = 0 }; workbook.Append(fileVersion); workbook.Append(workbookProperties); workbook.Append(bookViews); workbook.Append(sheets); workbook.Append(calculationProperties); workbookPart.Workbook = workbook; }
// Generates content of workbookPart1. private void GenerateWorkbookPart1Content(WorkbookPart workbookPart1) { Workbook workbook1 = new Workbook(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x15" } }; workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); workbook1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); workbook1.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); FileVersion fileVersion1 = new FileVersion(){ ApplicationName = "xl", LastEdited = "6", LowestEdited = "6", BuildVersion = "14420" }; WorkbookProperties workbookProperties1 = new WorkbookProperties(){ DefaultThemeVersion = (UInt32Value)153222U }; AlternateContent alternateContent1 = new AlternateContent(); alternateContent1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); AlternateContentChoice alternateContentChoice1 = new AlternateContentChoice(){ Requires = "x15" }; X15ac.AbsolutePath absolutePath1 = new X15ac.AbsolutePath(){ Url = "D:\\Users\\dito\\Desktop\\TestDocumentResaver\\OpenXmlApiConversion\\WorkBookPr\\" }; absolutePath1.AddNamespaceDeclaration("x15ac", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"); alternateContentChoice1.Append(absolutePath1); alternateContent1.Append(alternateContentChoice1); BookViews bookViews1 = new BookViews(); WorkbookView workbookView1 = new WorkbookView(){ XWindow = 0, YWindow = 0, WindowWidth = (UInt32Value)26940U, WindowHeight = (UInt32Value)15120U }; bookViews1.Append(workbookView1); Sheets sheets1 = new Sheets(); Sheet sheet1 = new Sheet(){ Name = "Sheet1", SheetId = (UInt32Value)1U, Id = "rId1" }; sheets1.Append(sheet1); CalculationProperties calculationProperties1 = new CalculationProperties(){ CalculationId = (UInt32Value)152511U }; WorkbookExtensionList workbookExtensionList1 = new WorkbookExtensionList(); WorkbookExtension workbookExtension1 = new WorkbookExtension(){ Uri = "{140A7094-0E35-4892-8432-C4D2E57EDEB5}" }; workbookExtension1.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.WorkbookProperties workbookProperties2 = new X15.WorkbookProperties(){ ChartTrackingReferenceBase = true }; workbookExtension1.Append(workbookProperties2); workbookExtensionList1.Append(workbookExtension1); workbook1.Append(fileVersion1); workbook1.Append(workbookProperties1); workbook1.Append(alternateContent1); workbook1.Append(bookViews1); workbook1.Append(sheets1); workbook1.Append(calculationProperties1); workbook1.Append(workbookExtensionList1); workbookPart1.Workbook = workbook1; }
// Generates content of workbookPart1. private void GenerateWorkbookPart1Content(WorkbookPart workbookPart1) { Workbook workbook1 = new Workbook(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x15" } }; workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); workbook1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); workbook1.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); FileVersion fileVersion1 = new FileVersion(){ ApplicationName = "xl", LastEdited = "6", LowestEdited = "6", BuildVersion = "14420" }; WorkbookProperties workbookProperties1 = new WorkbookProperties(){ DefaultThemeVersion = (UInt32Value)153222U }; AlternateContent alternateContent1 = new AlternateContent(); alternateContent1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); AlternateContentChoice alternateContentChoice1 = new AlternateContentChoice(){ Requires = "x15" }; X15ac.AbsolutePath absolutePath1 = new X15ac.AbsolutePath(){ Url = "D:\\Users\\dito\\Desktop\\TestDocumentResaver\\OpenXmlApiConversion\\Slicer\\" }; absolutePath1.AddNamespaceDeclaration("x15ac", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"); alternateContentChoice1.Append(absolutePath1); alternateContent1.Append(alternateContentChoice1); BookViews bookViews1 = new BookViews(); WorkbookView workbookView1 = new WorkbookView(){ XWindow = 0, YWindow = 0, WindowWidth = (UInt32Value)26940U, WindowHeight = (UInt32Value)15120U }; bookViews1.Append(workbookView1); Sheets sheets1 = new Sheets(); Sheet sheet1 = new Sheet(){ Name = "Sheet1", SheetId = (UInt32Value)1U, Id = "rId1" }; sheets1.Append(sheet1); DefinedNames definedNames1 = new DefinedNames(); DefinedName definedName1 = new DefinedName(){ Name = "Slicer_Column1" }; definedName1.Text = "#N/A"; DefinedName definedName2 = new DefinedName(){ Name = "Slicer_Column2" }; definedName2.Text = "#N/A"; DefinedName definedName3 = new DefinedName(){ Name = "Slicer_Column3" }; definedName3.Text = "#N/A"; definedNames1.Append(definedName1); definedNames1.Append(definedName2); definedNames1.Append(definedName3); CalculationProperties calculationProperties1 = new CalculationProperties(){ CalculationId = (UInt32Value)152511U }; WorkbookExtensionList workbookExtensionList1 = new WorkbookExtensionList(); WorkbookExtension workbookExtension1 = new WorkbookExtension(){ Uri = "{79F54976-1DA5-4618-B147-4CDE4B953A38}" }; workbookExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.WorkbookProperties workbookProperties2 = new X14.WorkbookProperties(); workbookExtension1.Append(workbookProperties2); WorkbookExtension workbookExtension2 = new WorkbookExtension(){ Uri = "{46BE6895-7355-4a93-B00E-2C351335B9C9}" }; workbookExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.SlicerCaches slicerCaches1 = new X15.SlicerCaches(); slicerCaches1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.SlicerCache slicerCache1 = new X14.SlicerCache(){ Id = "rId2" }; X14.SlicerCache slicerCache2 = new X14.SlicerCache(){ Id = "rId3" }; X14.SlicerCache slicerCache3 = new X14.SlicerCache(){ Id = "rId4" }; slicerCaches1.Append(slicerCache1); slicerCaches1.Append(slicerCache2); slicerCaches1.Append(slicerCache3); workbookExtension2.Append(slicerCaches1); WorkbookExtension workbookExtension3 = new WorkbookExtension(){ Uri = "{140A7094-0E35-4892-8432-C4D2E57EDEB5}" }; workbookExtension3.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.WorkbookProperties workbookProperties3 = new X15.WorkbookProperties(){ ChartTrackingReferenceBase = true }; workbookExtension3.Append(workbookProperties3); workbookExtensionList1.Append(workbookExtension1); workbookExtensionList1.Append(workbookExtension2); workbookExtensionList1.Append(workbookExtension3); workbook1.Append(fileVersion1); workbook1.Append(workbookProperties1); workbook1.Append(alternateContent1); workbook1.Append(bookViews1); workbook1.Append(sheets1); workbook1.Append(definedNames1); workbook1.Append(calculationProperties1); workbook1.Append(workbookExtensionList1); workbookPart1.Workbook = workbook1; }
// Generates content of workbookPart1. private void GenerateWorkbookPart1Content(WorkbookPart workbookPart1) { Workbook workbook1 = new Workbook() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x15" } }; workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); workbook1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); workbook1.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); FileVersion fileVersion1 = new FileVersion() { ApplicationName = "xl", LastEdited = "6", LowestEdited = "4", BuildVersion = "14420" }; WorkbookProperties workbookProperties1 = new WorkbookProperties() { FilterPrivacy = true, DefaultThemeVersion = (UInt32Value)124226U }; BookViews bookViews1 = new BookViews(); WorkbookView workbookView1 = new WorkbookView() { XWindow = 240, YWindow = 105, WindowWidth = (UInt32Value)14805U, WindowHeight = (UInt32Value)8010U }; bookViews1.Append(workbookView1); Sheets sheets1 = new Sheets(); Sheet sheet1 = new Sheet() { Name = "Sheet1", SheetId = (UInt32Value)1U, Id = "rId1" }; Sheet sheet2 = new Sheet() { Name = "Sheet2", SheetId = (UInt32Value)2U, Id = "rId2" }; sheets1.Append(sheet1); sheets1.Append(sheet2); CalculationProperties calculationProperties1 = new CalculationProperties() { CalculationId = (UInt32Value)152511U }; workbook1.Append(fileVersion1); workbook1.Append(workbookProperties1); workbook1.Append(bookViews1); workbook1.Append(sheets1); workbook1.Append(calculationProperties1); workbookPart1.Workbook = workbook1; }
// Generates content of workbookPart1. private void GenerateWorkbookPart1Content(WorkbookPart workbookPart1) { Workbook workbook1 = new Workbook(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x15" } }; workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); workbook1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); workbook1.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); FileVersion fileVersion1 = new FileVersion(){ ApplicationName = "xl", LastEdited = "6", LowestEdited = "6", BuildVersion = "14420" }; WorkbookProperties workbookProperties1 = new WorkbookProperties(); AlternateContent alternateContent1 = new AlternateContent(); alternateContent1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); AlternateContentChoice alternateContentChoice1 = new AlternateContentChoice(){ Requires = "x15" }; X15ac.AbsolutePath absolutePath1 = new X15ac.AbsolutePath(){ Url = "D:\\Users\\dito\\Desktop\\TestDocumentResaver\\OpenXmlApiConversion\\Timeline\\" }; absolutePath1.AddNamespaceDeclaration("x15ac", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"); alternateContentChoice1.Append(absolutePath1); alternateContent1.Append(alternateContentChoice1); BookViews bookViews1 = new BookViews(); WorkbookView workbookView1 = new WorkbookView(){ XWindow = 0, YWindow = 0, WindowWidth = (UInt32Value)26940U, WindowHeight = (UInt32Value)15120U }; bookViews1.Append(workbookView1); Sheets sheets1 = new Sheets(); Sheet sheet1 = new Sheet(){ Name = "data", SheetId = (UInt32Value)1U, Id = "rId1" }; Sheet sheet2 = new Sheet(){ Name = "data2", SheetId = (UInt32Value)3U, Id = "rId2" }; Sheet sheet3 = new Sheet(){ Name = "Cache", SheetId = (UInt32Value)4U, Id = "rId3" }; Sheet sheet4 = new Sheet(){ Name = "Level", SheetId = (UInt32Value)2U, Id = "rId4" }; Sheet sheet5 = new Sheet(){ Name = "Caption", SheetId = (UInt32Value)5U, Id = "rId5" }; Sheet sheet6 = new Sheet(){ Name = "ShowHeader", SheetId = (UInt32Value)6U, Id = "rId6" }; Sheet sheet7 = new Sheet(){ Name = "ShowSelectionLabel", SheetId = (UInt32Value)7U, Id = "rId7" }; Sheet sheet8 = new Sheet(){ Name = "ShowTimeLevel", SheetId = (UInt32Value)8U, Id = "rId8" }; Sheet sheet9 = new Sheet(){ Name = "ShowHorizontalScrollbar", SheetId = (UInt32Value)9U, Id = "rId9" }; Sheet sheet10 = new Sheet(){ Name = "ScrollPosition", SheetId = (UInt32Value)10U, Id = "rId10" }; Sheet sheet11 = new Sheet(){ Name = "Style", SheetId = (UInt32Value)11U, Id = "rId11" }; sheets1.Append(sheet1); sheets1.Append(sheet2); sheets1.Append(sheet3); sheets1.Append(sheet4); sheets1.Append(sheet5); sheets1.Append(sheet6); sheets1.Append(sheet7); sheets1.Append(sheet8); sheets1.Append(sheet9); sheets1.Append(sheet10); sheets1.Append(sheet11); DefinedNames definedNames1 = new DefinedNames(); DefinedName definedName1 = new DefinedName(){ Name = "NativeTimeline_Date" }; definedName1.Text = "#N/A"; DefinedName definedName2 = new DefinedName(){ Name = "NativeTimeline_DeliveryDate" }; definedName2.Text = "#N/A"; DefinedName definedName3 = new DefinedName(){ Name = "NativeTimeline_DeliveryDate1" }; definedName3.Text = "#N/A"; DefinedName definedName4 = new DefinedName(){ Name = "NativeTimeline_DeliveryDate2" }; definedName4.Text = "#N/A"; DefinedName definedName5 = new DefinedName(){ Name = "NativeTimeline_DeliveryDate3" }; definedName5.Text = "#N/A"; DefinedName definedName6 = new DefinedName(){ Name = "NativeTimeline_DeliveryDate4" }; definedName6.Text = "#N/A"; DefinedName definedName7 = new DefinedName(){ Name = "NativeTimeline_DeliveryDate5" }; definedName7.Text = "#N/A"; DefinedName definedName8 = new DefinedName(){ Name = "NativeTimeline_DeliveryDate6" }; definedName8.Text = "#N/A"; DefinedName definedName9 = new DefinedName(){ Name = "NativeTimeline_DeliveryDate7" }; definedName9.Text = "#N/A"; definedNames1.Append(definedName1); definedNames1.Append(definedName2); definedNames1.Append(definedName3); definedNames1.Append(definedName4); definedNames1.Append(definedName5); definedNames1.Append(definedName6); definedNames1.Append(definedName7); definedNames1.Append(definedName8); definedNames1.Append(definedName9); CalculationProperties calculationProperties1 = new CalculationProperties(){ CalculationId = (UInt32Value)152511U }; PivotCaches pivotCaches1 = new PivotCaches(); PivotCache pivotCache1 = new PivotCache(){ CacheId = (UInt32Value)0U, Id = "rId12" }; PivotCache pivotCache2 = new PivotCache(){ CacheId = (UInt32Value)1U, Id = "rId13" }; pivotCaches1.Append(pivotCache1); pivotCaches1.Append(pivotCache2); WorkbookExtensionList workbookExtensionList1 = new WorkbookExtensionList(); WorkbookExtension workbookExtension1 = new WorkbookExtension(){ Uri = "{79F54976-1DA5-4618-B147-4CDE4B953A38}" }; workbookExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.WorkbookProperties workbookProperties2 = new X14.WorkbookProperties(); workbookExtension1.Append(workbookProperties2); WorkbookExtension workbookExtension2 = new WorkbookExtension(){ Uri = "{D0CA8CA8-9F24-4464-BF8E-62219DCF47F9}" }; workbookExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.TimelineCacheReferences timelineCacheReferences1 = new X15.TimelineCacheReferences(); X15.TimelineCacheReference timelineCacheReference1 = new X15.TimelineCacheReference(){ Id = "rId14" }; X15.TimelineCacheReference timelineCacheReference2 = new X15.TimelineCacheReference(){ Id = "rId15" }; X15.TimelineCacheReference timelineCacheReference3 = new X15.TimelineCacheReference(){ Id = "rId16" }; X15.TimelineCacheReference timelineCacheReference4 = new X15.TimelineCacheReference(){ Id = "rId17" }; X15.TimelineCacheReference timelineCacheReference5 = new X15.TimelineCacheReference(){ Id = "rId18" }; X15.TimelineCacheReference timelineCacheReference6 = new X15.TimelineCacheReference(){ Id = "rId19" }; X15.TimelineCacheReference timelineCacheReference7 = new X15.TimelineCacheReference(){ Id = "rId20" }; X15.TimelineCacheReference timelineCacheReference8 = new X15.TimelineCacheReference(){ Id = "rId21" }; X15.TimelineCacheReference timelineCacheReference9 = new X15.TimelineCacheReference(){ Id = "rId22" }; timelineCacheReferences1.Append(timelineCacheReference1); timelineCacheReferences1.Append(timelineCacheReference2); timelineCacheReferences1.Append(timelineCacheReference3); timelineCacheReferences1.Append(timelineCacheReference4); timelineCacheReferences1.Append(timelineCacheReference5); timelineCacheReferences1.Append(timelineCacheReference6); timelineCacheReferences1.Append(timelineCacheReference7); timelineCacheReferences1.Append(timelineCacheReference8); timelineCacheReferences1.Append(timelineCacheReference9); workbookExtension2.Append(timelineCacheReferences1); WorkbookExtension workbookExtension3 = new WorkbookExtension(){ Uri = "{140A7094-0E35-4892-8432-C4D2E57EDEB5}" }; workbookExtension3.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.WorkbookProperties workbookProperties3 = new X15.WorkbookProperties(){ ChartTrackingReferenceBase = true }; workbookExtension3.Append(workbookProperties3); workbookExtensionList1.Append(workbookExtension1); workbookExtensionList1.Append(workbookExtension2); workbookExtensionList1.Append(workbookExtension3); workbook1.Append(fileVersion1); workbook1.Append(workbookProperties1); workbook1.Append(alternateContent1); workbook1.Append(bookViews1); workbook1.Append(sheets1); workbook1.Append(definedNames1); workbook1.Append(calculationProperties1); workbook1.Append(pivotCaches1); workbook1.Append(workbookExtensionList1); workbookPart1.Workbook = workbook1; }
internal void FromWorkbookProperties(WorkbookProperties wp) { this.SetAllNull(); if (wp.Date1904 != null) this.Date1904 = wp.Date1904.Value; if (wp.DateCompatibility != null) this.DateCompatibility = wp.DateCompatibility.Value; if (wp.ShowObjects != null) this.ShowObjects = wp.ShowObjects.Value; if (wp.ShowBorderUnselectedTables != null) this.ShowBorderUnselectedTables = wp.ShowBorderUnselectedTables.Value; if (wp.FilterPrivacy != null) this.FilterPrivacy = wp.FilterPrivacy.Value; if (wp.PromptedSolutions != null) this.PromptedSolutions = wp.PromptedSolutions.Value; if (wp.ShowInkAnnotation != null) this.ShowInkAnnotation = wp.ShowInkAnnotation.Value; if (wp.BackupFile != null) this.BackupFile = wp.BackupFile.Value; if (wp.SaveExternalLinkValues != null) this.SaveExternalLinkValues = wp.SaveExternalLinkValues.Value; if (wp.UpdateLinks != null) this.UpdateLinks = wp.UpdateLinks.Value; if (wp.CodeName != null) this.CodeName = wp.CodeName.Value; if (wp.HidePivotFieldList != null) this.HidePivotFieldList = wp.HidePivotFieldList.Value; if (wp.ShowPivotChartFilter != null) this.ShowPivotChartFilter = wp.ShowPivotChartFilter.Value; if (wp.AllowRefreshQuery != null) this.AllowRefreshQuery = wp.AllowRefreshQuery.Value; if (wp.PublishItems != null) this.PublishItems = wp.PublishItems.Value; if (wp.CheckCompatibility != null) this.CheckCompatibility = wp.CheckCompatibility.Value; if (wp.AutoCompressPictures != null) this.AutoCompressPictures = wp.AutoCompressPictures.Value; if (wp.RefreshAllConnections != null) this.RefreshAllConnections = wp.RefreshAllConnections.Value; if (wp.DefaultThemeVersion != null) this.DefaultThemeVersion = wp.DefaultThemeVersion.Value; }
internal WorkbookProperties ToWorkbookProperties() { WorkbookProperties wp = new WorkbookProperties(); if (this.bDate1904 != null) wp.Date1904 = this.bDate1904.Value; if (this.bDateCompatibility != null) wp.DateCompatibility = this.bDateCompatibility.Value; if (this.vShowObjects != null) wp.ShowObjects = this.vShowObjects.Value; if (this.bShowBorderUnselectedTables != null) wp.ShowBorderUnselectedTables = this.bShowBorderUnselectedTables.Value; if (this.bFilterPrivacy != null) wp.FilterPrivacy = this.bFilterPrivacy.Value; if (this.bPromptedSolutions != null) wp.PromptedSolutions = this.bPromptedSolutions.Value; if (this.bShowInkAnnotation != null) wp.ShowInkAnnotation = this.bShowInkAnnotation.Value; if (this.bBackupFile != null) wp.BackupFile = this.bBackupFile.Value; if (this.bSaveExternalLinkValues != null) wp.SaveExternalLinkValues = this.bSaveExternalLinkValues.Value; if (this.vUpdateLinks != null) wp.UpdateLinks = this.vUpdateLinks.Value; if (this.sCodeName != null) wp.CodeName = this.sCodeName; if (this.bHidePivotFieldList != null) wp.HidePivotFieldList = this.bHidePivotFieldList.Value; if (this.bShowPivotChartFilter != null) wp.ShowPivotChartFilter = this.bShowPivotChartFilter.Value; if (this.bAllowRefreshQuery != null) wp.AllowRefreshQuery = this.bAllowRefreshQuery.Value; if (this.bPublishItems != null) wp.PublishItems = this.bPublishItems.Value; if (this.bCheckCompatibility != null) wp.CheckCompatibility = this.bCheckCompatibility.Value; if (this.bAutoCompressPictures != null) wp.AutoCompressPictures = this.bAutoCompressPictures.Value; if (this.bRefreshAllConnections != null) wp.RefreshAllConnections = this.bRefreshAllConnections.Value; if (this.iDefaultThemeVersion != null) wp.DefaultThemeVersion = this.iDefaultThemeVersion.Value; return wp; }
// Generates content of workbookPart1. private void GenerateWorkbookPart1Content(WorkbookPart workbookPart1) { Workbook workbook1 = new Workbook(); FileVersion fileVersion1 = new FileVersion() { ApplicationName = "xl", LastEdited = "4", LowestEdited = "4", BuildVersion = "4506" }; WorkbookProperties workbookProperties1 = new WorkbookProperties() { DefaultThemeVersion = (UInt32Value)124226U }; BookViews bookViews1 = new BookViews(); WorkbookView workbookView1 = new WorkbookView() { XWindow = 0, YWindow = 45, WindowWidth = (UInt32Value)19155U, WindowHeight = (UInt32Value)11820U }; bookViews1.Append(workbookView1); Sheets sheets1 = new Sheets(); //Sheet sheet1 = new Sheet() { Name = "Sheet1", SheetId = (UInt32Value)1U, Id = "rId1" }; //Sheet sheet2 = new Sheet() { Name = "Sheet2", SheetId = (UInt32Value)2U, Id = "rId2" }; //Sheet sheet3 = new Sheet() { Name = "Sheet3", SheetId = (UInt32Value)3U, Id = "rId3" }; //sheets1.Append(sheet1); //sheets1.Append(sheet2); //sheets1.Append(sheet3); CalculationProperties calculationProperties1 = new CalculationProperties() { CalculationId = (UInt32Value)125725U }; workbook1.Append(fileVersion1); workbook1.Append(workbookProperties1); workbook1.Append(bookViews1); workbook1.Append(sheets1); workbook1.Append(calculationProperties1); workbookPart1.Workbook = workbook1; }