diff --git a/ClosedXML/Excel/XLWorkbook.cs b/ClosedXML/Excel/XLWorkbook.cs index 405623a..ac31b4e 100644 --- a/ClosedXML/Excel/XLWorkbook.cs +++ b/ClosedXML/Excel/XLWorkbook.cs @@ -265,6 +265,12 @@ /// public XLCalculateMode CalculateMode { get; set; } + + public Boolean CalculationOnSave { get; set; } + public Boolean ForceFullCalculation { get; set; } + public Boolean FullCalculationOnLoad { get; set; } + public Boolean FullPrecision { get; set; } + /// /// Gets or sets the workbook's reference style. /// diff --git a/ClosedXML/Excel/XLWorkbook_Load.cs b/ClosedXML/Excel/XLWorkbook_Load.cs index 4c3424f..bed27ac 100644 --- a/ClosedXML/Excel/XLWorkbook_Load.cs +++ b/ClosedXML/Excel/XLWorkbook_Load.cs @@ -100,13 +100,30 @@ var calculationProperties = dSpreadsheet.WorkbookPart.Workbook.CalculationProperties; if (calculationProperties != null) { + var calculateMode = calculationProperties.CalculationMode; + if (calculateMode != null) + CalculateMode = calculateMode.Value.ToClosedXml(); + + var calculationOnSave = calculationProperties.CalculationOnSave; + if (calculationOnSave != null) + CalculationOnSave = calculationOnSave.Value; + + var forceFullCalculation = calculationProperties.ForceFullCalculation; + if (forceFullCalculation != null) + ForceFullCalculation = forceFullCalculation.Value; + + var fullCalculationOnLoad = calculationProperties.FullCalculationOnLoad; + if (fullCalculationOnLoad != null) + FullCalculationOnLoad = fullCalculationOnLoad.Value; + + var fullPrecision = calculationProperties.FullPrecision; + if (fullPrecision != null) + FullPrecision = fullPrecision.Value; + var referenceMode = calculationProperties.ReferenceMode; if (referenceMode != null) ReferenceStyle = referenceMode.Value.ToClosedXml(); - var calculateMode = calculationProperties.CalculationMode; - if (calculateMode != null) - CalculateMode = calculateMode.Value.ToClosedXml(); } var efp = dSpreadsheet.ExtendedFilePropertiesPart; diff --git a/ClosedXML/Excel/XLWorkbook_Save.cs b/ClosedXML/Excel/XLWorkbook_Save.cs index 0e14564..af825e4 100644 --- a/ClosedXML/Excel/XLWorkbook_Save.cs +++ b/ClosedXML/Excel/XLWorkbook_Save.cs @@ -770,6 +770,11 @@ workbook.CalculationProperties.ReferenceMode = null; else workbook.CalculationProperties.ReferenceMode = ReferenceStyle.ToOpenXml(); + + if (CalculationOnSave) workbook.CalculationProperties.CalculationOnSave = CalculationOnSave; + if (ForceFullCalculation) workbook.CalculationProperties.ForceFullCalculation = ForceFullCalculation; + if (FullCalculationOnLoad) workbook.CalculationProperties.FullCalculationOnLoad = FullCalculationOnLoad; + if (FullPrecision) workbook.CalculationProperties.FullPrecision = FullPrecision; } private void GenerateSharedStringTablePartContent(SharedStringTablePart sharedStringTablePart,