diff --git a/Directory.Build.props b/Directory.Build.props index 42272b83..84d70575 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,7 +12,7 @@ MIT ..\bin\ DraviaVemal - 2.9.0-Alpha.5 + 2.9.0 DraviaVemal Copyright (c) 2023 DraviaVemal Permission is hereby granted, free of charge, to any person obtaining a copy of this diff --git a/Spreadsheet/Components/2007/Worksheet.cs b/Spreadsheet/Components/2007/Worksheet.cs index 4a7bfe19..e26ddd78 100644 --- a/Spreadsheet/Components/2007/Worksheet.cs +++ b/Spreadsheet/Components/2007/Worksheet.cs @@ -109,7 +109,7 @@ public void SetSheetViewOptions(WorkSheetViewOption workSheetViewOption) GetSheetView().ShowGridLines = workSheetViewOption.showGridLines; GetSheetView().ShowRowColHeaders = workSheetViewOption.showRowColHeaders; GetSheetView().ShowRuler = workSheetViewOption.showRuler; - GetSheetView().View = GetSheetViewValue(workSheetViewOption.workSheetViewsValues); + GetSheetView().View = GetSheetViewValue(workSheetViewOption.workSheetViewsValue); GetSheetView().ZoomScaleNormal = workSheetViewOption.ZoomScale; GetSheetView().ZoomScale = workSheetViewOption.ZoomScale; } diff --git a/Spreadsheet/Models/2007/WorksheetModel.cs b/Spreadsheet/Models/2007/WorksheetModel.cs index 7854702f..c029815b 100644 --- a/Spreadsheet/Models/2007/WorksheetModel.cs +++ b/Spreadsheet/Models/2007/WorksheetModel.cs @@ -219,7 +219,7 @@ public uint ZoomScale /// /// /// - public WorkSheetViewsValues workSheetViewsValues = WorkSheetViewsValues.NORMAL; + public WorkSheetViewsValues workSheetViewsValue = WorkSheetViewsValues.NORMAL; /// /// /// diff --git a/Tests/Spreadsheet.cs b/Tests/Spreadsheet.cs index 144d9f09..235e8fab 100644 --- a/Tests/Spreadsheet.cs +++ b/Tests/Spreadsheet.cs @@ -10,7 +10,18 @@ namespace OpenXMLOffice.Tests [TestClass] public class Spreadsheet { - private static readonly Excel excel = new(); + private static readonly Excel excel = new(new ExcelProperties + { + coreProperties = new() + { + title = "Test File", + creator = "OpenXML-Office", + subject = "Test Subject", + tags = "Test", + category = "Test Category", + description = "Describe the test file" + } + }); private static readonly string resultPath = "../../TestOutputFiles"; /// /// Initialize excel Test @@ -40,6 +51,15 @@ public static void ClassCleanup() excel.SaveAs(string.Format("{1}/test-{0}.xlsx", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), resultPath)); } /// + /// + /// + [TestMethod] + public void BlankFile() + { + Excel excel2 = new(); + excel2.SaveAs(string.Format("{1}/Blank-{0}.xlsx", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), resultPath)); + } + /// /// Add Sheet Test /// [TestMethod] @@ -264,9 +284,21 @@ public void TestSheetView() showGridLines = false, showRowColHeaders = false, showRuler = false, - workSheetViewsValues = WorkSheetViewsValues.PAGE_LAYOUT, + workSheetViewsValue = WorkSheetViewsValues.PAGE_LAYOUT, ZoomScale = 110 }); + excel.AddSheet("Zoom 400").SetSheetViewOptions(new() + { + ZoomScale = 500 // Should auto correct to 400 + }); + excel.AddSheet("Zoom 10").SetSheetViewOptions(new() + { + ZoomScale = 0 // Should auto correct to 10 + }); + excel.AddSheet("Page Break").SetSheetViewOptions(new() + { + workSheetViewsValue = WorkSheetViewsValues.PAGE_BREAK_PREVIEW, + }); } /// @@ -357,6 +389,28 @@ public void AddAllCharts() cellIdEnd = "D4" }, new AreaChartSetting() { + areaChartSeriesSettings = new(){ + new(){ + trendLines = new(){ + new(){ + trendLineType = TrendLineTypes.LINEAR, + trendLineName = "Dravia", + hexColor = "FF0000", + lineStye = DrawingPresetLineDashValues.LARGE_DASH + } + } + }, + new(){ + trendLines = new(){ + new(){ + trendLineType = TrendLineTypes.EXPONENTIAL, + trendLineName = "vemal", + hexColor = "FFFF00", + lineStye = DrawingPresetLineDashValues.DASH_DOT + } + } + } + }, applicationSpecificSetting = new() { from = new() @@ -377,6 +431,11 @@ public void AddAllCharts() cellIdEnd = "D4" }, new AreaChartSetting() { + areaChartDataLabel = new() + { + dataLabelPosition = AreaChartDataLabel.DataLabelPositionValues.SHOW, + isBold = true + }, areaChartType = AreaChartTypes.STACKED, applicationSpecificSetting = new() { @@ -413,6 +472,69 @@ public void AddAllCharts() } } }); + worksheet.AddChart(new() + { + cellIdStart = "A1", + cellIdEnd = "D4" + }, new AreaChartSetting() + { + areaChartType = AreaChartTypes.CLUSTERED_3D, + applicationSpecificSetting = new() + { + from = new() + { + row = 5, + column = 25 + }, + to = new() + { + row = 20, + column = 40 + } + } + }); + worksheet.AddChart(new() + { + cellIdStart = "A1", + cellIdEnd = "D4" + }, new AreaChartSetting() + { + areaChartType = AreaChartTypes.STACKED_3D, + applicationSpecificSetting = new() + { + from = new() + { + row = 21, + column = 25 + }, + to = new() + { + row = 41, + column = 40 + } + } + }); + worksheet.AddChart(new() + { + cellIdStart = "A1", + cellIdEnd = "D4" + }, new AreaChartSetting() + { + areaChartType = AreaChartTypes.PERCENT_STACKED_3D, + applicationSpecificSetting = new() + { + from = new() + { + row = 42, + column = 25 + }, + to = new() + { + row = 62, + column = 40 + } + } + }); row = 0; worksheet = excel.AddSheet("Bar Chart"); CommonMethod.CreateDataCellPayload().ToList().ForEach(rowData => @@ -844,6 +966,28 @@ public void AddAllCharts() cellIdEnd = "F4" }, new ScatterChartSetting() { + scatterChartSeriesSettings = new(){ + new(){ + trendLines = new(){ + new(){ + trendLineType = TrendLineTypes.LINEAR, + trendLineName = "Dravia", + hexColor = "FF0000", + lineStye = DrawingPresetLineDashValues.LARGE_DASH + } + } + }, + new(){ + trendLines = new(){ + new(){ + trendLineType = TrendLineTypes.EXPONENTIAL, + trendLineName = "vemal", + hexColor = "FFFF00", + lineStye = DrawingPresetLineDashValues.DASH_DOT + } + } + } + }, scatterChartType = ScatterChartTypes.BUBBLE, applicationSpecificSetting = new() {