Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ExcelOps-EpplusFreeFixCalcsEdition/AssemblyInfo.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices

<Assembly: AssemblyTrademark("camm")>
<Assembly: ComVisible(False)>

<Assembly: Runtime.CompilerServices.InternalsVisibleTo("CompuMaster.Excel.Test")>
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ Namespace ExcelOps
Me._WorkbookPackage.Compatibility.IsWorksheets1Based = False

'set workbook FullCalcOnLoad always to False since it's already triggered using property of Me.AutoCalculationOnLoad
Me.Workbook.FullCalcOnLoad = FULL_CALC_ON_LOAD 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
Me.Workbook.FullCalcOnLoad = Me.AutoCalculationOnLoad 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
Me.Workbook.Worksheets.Add("Sheet1")
End Sub

Expand All @@ -526,7 +526,7 @@ Namespace ExcelOps
Me._WorkbookPackage.Compatibility.IsWorksheets1Based = False

'set workbook FullCalcOnLoad always to False since it's already triggered using property of Me.AutoCalculationOnLoad
Me.Workbook.FullCalcOnLoad = FULL_CALC_ON_LOAD 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
Me.Workbook.FullCalcOnLoad = Me.AutoCalculationOnLoad 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
End Sub

Protected Overrides Sub LoadWorkbook(data As Byte())
Expand All @@ -545,7 +545,7 @@ Namespace ExcelOps
Me._WorkbookPackage.Compatibility.IsWorksheets1Based = False

'set workbook FullCalcOnLoad always to False since it's already triggered using property of Me.AutoCalculationOnLoad
Me.Workbook.FullCalcOnLoad = FULL_CALC_ON_LOAD 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
Me.Workbook.FullCalcOnLoad = Me.AutoCalculationOnLoad 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
End Sub

''' <summary>
Expand Down Expand Up @@ -927,18 +927,27 @@ Namespace ExcelOps
End Sub

''' <summary>
''' Is the Excel engine allowed to automatically/continuously calculate on every change or does the user has to manually force a recalculation (typically by pressing F9 key in MS Excel)
''' If enabled, the calculation engine will do a full recalculation after every modification.
''' If disabled, the calculation engine is not allowed to automatically/continuously calculate on every change and the user has to manually force a recalculation (typically by pressing F9 key in MS Excel).
''' </summary>
''' <returns></returns>
Public Overrides Property AutoCalculationEnabled As Boolean
''' <remarks>Please note: this property is a workbook property (not an engine property!)</remarks>
Public Overrides Property AutoCalculationEnabledWorkbookSetting As Boolean
Get
Return (Me.Workbook.CalcMode = ExcelCalcMode.Automatic)
If Me._WorkbookPackage IsNot Nothing Then
Return (Me.Workbook.CalcMode = ExcelCalcMode.Automatic)
Else
Return MyBase.AutoCalculationEnabledWorkbookSetting
End If
End Get
Set(value As Boolean)
If value Then
Me.Workbook.CalcMode = ExcelCalcMode.Automatic
Else
Me.Workbook.CalcMode = ExcelCalcMode.Manual
MyBase.AutoCalculationEnabledWorkbookSetting = value
If Me._WorkbookPackage IsNot Nothing Then
If value Then
Me.Workbook.CalcMode = ExcelCalcMode.Automatic
Else
Me.Workbook.CalcMode = ExcelCalcMode.Manual
End If
End If
End Set
End Property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,59 +19,121 @@ Namespace ExcelOps
Public Class EpplusFreeExcelDataOperations
Inherits ExcelDataOperationsBase

Protected Overrides ReadOnly Property DefaultCalculationOptions As ExcelEngineDefaultOptions
Get
Return New ExcelEngineDefaultOptions(False, True)
End Get
End Property

''' <summary>
''' Create or open a workbook (reminder: set System.Threading.Thread.CurrentThread.CurrentCulture as required BEFORE creating the instance to ensure the engine uses the correct culture later on)
''' </summary>
''' <param name="file">Path to a file which shall be loaded or null if a new workbook shall be created</param>
''' <param name="mode">Open an existing file or (re)create a new file</param>
''' <param name="options">File and engine options</param>
''' <remarks>
''' Just as a reminder for usage of FreeSpire.Xls: the manufacturer has limited the feature set for this component. Free version is limited to 5 sheets per workbook and 150 rows per sheet.
''' See https://www.e-iceblue.com/ for more details on limitations and licensing.
''' </remarks>
Public Sub New(file As String, mode As OpenMode, options As ExcelDataOperationsOptions)
MyBase.New(file, mode, options)
End Sub

''' <summary>
''' Create a new workbook or just create an uninitialized instance of this Excel engine
''' </summary>
''' <param name="mode"></param>
Public Sub New(mode As OpenMode)
MyBase.New(mode)
End Sub

''' <summary>
''' Create a new workbook or just create an uninitialized instance of this Excel engine
''' </summary>
''' <param name="mode"></param>
''' <param name="options"></param>
Public Sub New(mode As OpenMode, options As ExcelDataOperationsOptions)
MyBase.New(mode, options)
End Sub

''' <summary>
''' Open a workbook
''' </summary>
''' <param name="data"></param>
''' <param name="options">File and engine options</param>
Public Sub New(data As Byte(), options As ExcelDataOperationsOptions)
MyBase.New(data, options)
End Sub

''' <summary>
''' Open a workbook
''' </summary>
''' <param name="data"></param>
''' <param name="options">File and engine options</param>
Public Sub New(data As System.IO.Stream, options As ExcelDataOperationsOptions)
MyBase.New(data, options)
End Sub

''' <summary>
''' Create or open a workbook
''' </summary>
<Obsolete("Use overloaded method with ExcelDataOperationsOptions", False)>
<System.ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)>
Public Sub New(file As String, mode As OpenMode, [readOnly] As Boolean, passwordForOpening As String, disableInitialCalculation As Boolean)
MyBase.New(file, mode, Not disableInitialCalculation, False, [readOnly], passwordForOpening)
End Sub

''' <summary>
''' Create or open a workbook
''' </summary>
<Obsolete("Use overloaded method with ExcelDataOperationsOptions", False)>
<System.ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)>
Public Sub New(file As String, mode As OpenMode, [readOnly] As Boolean, passwordForOpening As String)
MyBase.New(file, mode, False, True, [readOnly], passwordForOpening)
End Sub

''' <summary>
''' Open a workbook
''' </summary>
<Obsolete("Use overloaded method with ExcelDataOperationsOptions", False)>
<System.ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)>
Public Sub New(data As Byte(), passwordForOpening As String)
MyBase.New(data, False, True, passwordForOpening)
End Sub

''' <summary>
''' Open a workbook
''' </summary>
<Obsolete("Use overloaded method with ExcelDataOperationsOptions", False)>
<System.ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)>
Public Sub New(data As Byte(), passwordForOpening As String, disableInitialCalculation As Boolean)
MyBase.New(data, Not disableInitialCalculation, True, passwordForOpening)
End Sub

''' <summary>
''' Open a workbook
''' </summary>
<Obsolete("Use overloaded method with ExcelDataOperationsOptions", False)>
<System.ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)>
Public Sub New(data As System.IO.Stream, passwordForOpening As String)
MyBase.New(data, False, True, passwordForOpening)
End Sub

''' <summary>
''' Open a workbook
''' </summary>
<Obsolete("Use overloaded method with ExcelDataOperationsOptions", False)>
<System.ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)>
Public Sub New(data As System.IO.Stream, passwordForOpening As String, disableInitialCalculation As Boolean)
MyBase.New(data, Not disableInitialCalculation, True, passwordForOpening)
End Sub

''' <summary>
''' Create a new instance for accessing Excel workbooks (still requires creating or loading of a workbook)
''' </summary>
Public Sub New()
Me.New(Nothing)
End Sub

''' <summary>
''' Create a new instance for accessing Excel workbooks (still requires creating or loading of a workbook)
''' </summary>
''' <param name="passwordForOpeningOnNextTime">Pre-define encryption password on future save actions</param>
<Obsolete("Use overloaded method with ExcelDataOperationsOptions", False)>
<System.ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never)>
Public Sub New(passwordForOpeningOnNextTime As String)
MyBase.New(False, True, True, passwordForOpeningOnNextTime)
End Sub
Expand All @@ -82,8 +144,6 @@ Namespace ExcelOps
End Get
End Property

Private Const FULL_CALC_ON_LOAD As Boolean = True

Private _WorkbookPackage As CompuMaster.Epplus4.ExcelPackage
Public ReadOnly Property WorkbookPackage As CompuMaster.Epplus4.ExcelPackage
Get
Expand Down
8 changes: 8 additions & 0 deletions ExcelOps-EpplusPolyform/AssemblyInfo.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices

<Assembly: AssemblyTrademark("camm")>
<Assembly: ComVisible(False)>

<Assembly: Runtime.CompilerServices.InternalsVisibleTo("CompuMaster.Excel.Test")>
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ Namespace ExcelOps
Me._WorkbookPackage.Compatibility.IsWorksheets1Based = False

'set workbook FullCalcOnLoad always to False since it's already triggered using property of Me.AutoCalculationOnLoad
Me.Workbook.FullCalcOnLoad = FULL_CALC_ON_LOAD 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
Me.Workbook.FullCalcOnLoad = Me.AutoCalculationOnLoad 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
Me.Workbook.Worksheets.Add("Sheet1")
End Sub

Expand All @@ -526,7 +526,7 @@ Namespace ExcelOps
Me._WorkbookPackage.Compatibility.IsWorksheets1Based = False

'set workbook FullCalcOnLoad always to False since it's already triggered using property of Me.AutoCalculationOnLoad
Me.Workbook.FullCalcOnLoad = FULL_CALC_ON_LOAD 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
Me.Workbook.FullCalcOnLoad = Me.AutoCalculationOnLoad 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
End Sub

Protected Overrides Sub LoadWorkbook(data As Byte())
Expand All @@ -545,7 +545,7 @@ Namespace ExcelOps
Me._WorkbookPackage.Compatibility.IsWorksheets1Based = False

'set workbook FullCalcOnLoad always to False since it's already triggered using property of Me.AutoCalculationOnLoad
Me.Workbook.FullCalcOnLoad = FULL_CALC_ON_LOAD 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
Me.Workbook.FullCalcOnLoad = Me.AutoCalculationOnLoad 'unknown if executed after loading already completed or if it's a workbook setting with effect on opening as user in MS Excel, too
End Sub

''' <summary>
Expand Down Expand Up @@ -927,18 +927,27 @@ Namespace ExcelOps
End Sub

''' <summary>
''' Is the Excel engine allowed to automatically/continuously calculate on every change or does the user has to manually force a recalculation (typically by pressing F9 key in MS Excel)
''' If enabled, the calculation engine will do a full recalculation after every modification.
''' If disabled, the calculation engine is not allowed to automatically/continuously calculate on every change and the user has to manually force a recalculation (typically by pressing F9 key in MS Excel).
''' </summary>
''' <returns></returns>
Public Overrides Property AutoCalculationEnabled As Boolean
''' <remarks>Please note: this property is a workbook property (not an engine property!)</remarks>
Public Overrides Property AutoCalculationEnabledWorkbookSetting As Boolean
Get
Return (Me.Workbook.CalcMode = ExcelCalcMode.Automatic)
If Me._WorkbookPackage IsNot Nothing Then
Return (Me.Workbook.CalcMode = ExcelCalcMode.Automatic)
Else
Return MyBase.AutoCalculationEnabledWorkbookSetting
End If
End Get
Set(value As Boolean)
If value Then
Me.Workbook.CalcMode = ExcelCalcMode.Automatic
Else
Me.Workbook.CalcMode = ExcelCalcMode.Manual
MyBase.AutoCalculationEnabledWorkbookSetting = value
If Me._WorkbookPackage IsNot Nothing Then
If value Then
Me.Workbook.CalcMode = ExcelCalcMode.Automatic
Else
Me.Workbook.CalcMode = ExcelCalcMode.Manual
End If
End If
End Set
End Property
Expand Down
Loading
Loading