EPPlus
This attributes can only be used on properties that are of the type IDictionary<string, string>.
Columns will be added based on the items in
Order of the columns value, default value is 0
The values of this array will be used to generate columns (one column for each item).
Should be unique within all attributes. Will be used to retrieve the keys of the Dictionary
that also will be used to create the columns for this property.
Use this attribute on a class or an interface to insert a column with a formula
The spreadsheet formula (don't include the leading '='). If you use the {row} placeholder in the formula it will be replaced with the actual row of each cell in the column.
The spreadsheet formula (don't include the leading '=') in R1C1 format.
Use this attribute to indicate that the attribute target should be ignored.
Attribute used by to support complex type properties/>
Order of the columns value, default value is 0
This will prefix all names derived by members in the complex type.
Attribute used by to configure parameters for the functions/>
Constructor
Table style
If true, there will be a header row with column names over the data
If true, the first column of the table is highlighted
If true, the last column of the table is highlighted
If true, a totals row will be added under the table data. This should be used in combination with on the column attributes.
If true, column width will be adjusted to cell content
If true, EPPlus will calculate the table range when the data has been read into the spreadsheet and store the results
in the Value property of each cell.
If set, this must be implementing the interface. If not an Exception will be thrown.
Note that the implementing type must have an empty constructor.
Use this attribute on a Method, Property or a Field to set parameters for how an object should be represented when imported to a range.
Attribute used by to configure column parameters for the functions/>
Order of the columns value, default value is 0
Name shown in the header row, overriding the property name
Excel format string for the column
A number to be used in a NumberFormatProvider.
Default value is int.MinValue, which means it will be ignored.
If true, the entire column will be hidden.
Indicates whether the Built in (default) hyperlink style should be
applied to hyperlinks or not. Default value is true.
If not the last cell in the column (the totals row) will contain a formula of the specified type.
Formula for the total row of this column.
Number format for this columns cell in the totals row.
Text in this columns cell in the totals row
Attribute used by to configure sorting of properties for the functions. Overrides any other configured sort order./>
Property names used for the sort.
Settings to stay compatible with older versions of EPPlus
If the worksheets collection of the ExcelWorkbook class is 1 based.
This property can be set from appsettings.json file.
{
"EPPlus": {
"ExcelPackage": {
"Compatibility": {
"IsWorksheets1Based": true //Default and recommended value is false
}
}
}
}
Returns the encoding with the specified code page number
Returns the encoding with the specified name
IExcelConditionalFormattingAverageGroup
IExcelConditionalFormattingBeginsWith
IExcelConditionalFormattingBetween
IExcelConditionalFormattingColorScaleGroup
IExcelConditionalFormattingContainsBlanks
IExcelConditionalFormattingContainsErrors
IExcelConditionalFormattingContainsText
IExcelConditionalFormattingDataBar
ShowValue
If the databar should be a gradient. True by default
Wheter there is a border color or not.
False by default. Is set to true if BorderColor or NegativeBorderColor is set
Wheter negative and positive values should have the same colour.
False by default. Is set to true if NegativeFillColor is set.
Wheter negative and positive values should have the same border colour.
False by default. Is set to true if NegativeBorderColor is set.
What position the axis between positive and negative values is to be put at.
Databar Low Value
Databar High Value
The color of the databar. ShortHand for FillColor.Color
Fill color of Databar
Border color of databar.
Setting any property sets Border to true
Fill color for negative values
Setting any property sets NegativeBarColorSameAsPositive to false
Border color for negative values
Setting any property sets NegativeBarBorderColorSameAsPositive to false
Color of the axis between negative and positive values
Direction of the Databar
IExcelConditionalFormattingDuplicateValues
IExcelConditionalFormattingEndsWith
IExcelConditionalFormattingEqual
IExcelConditionalFormattingExpression
IExcelConditionalFormattingFiveIconSet
eExcelconditionalFormatting4IconsSetType
Icon5 (part of the 5 Icon Set)
IExcelConditionalFormattingFourIconSet
Icon4 (part of the 4 ou 5 Icon Set)
IExcelConditionalFormattingGreaterThan
IExcelConditionalFormattingGreaterThanOrEqual
IExcelConditionalFormattingIconSetGroup
Reverse
ShowValue
True if percent based
True if the Iconset has custom icons
IconSet (3, 4 or 5 IconSet)
IExcelConditionalFormattingLessThan
IExcelConditionalFormattingGreaterThanOrEqual
IExcelConditionalFormattingNotBetween
IExcelConditionalFormattingNotContainsBlanks
IExcelConditionalFormattingNotContainsErrors
IExcelConditionalFormattingNotContainsText
IExcelConditionalFormattingNotEqual
Interface for conditional formatting rule
The type of conditional formatting rule.
The range over which these conditional formatting rules apply.
The priority of the rule.
Priority for the rule gets lower the higher this number is. 1 is the highest priority.
If this property is true, no rules with lower priority should be applied over this rule.
Gives access to the differencial styling (DXF) for the rule.
Indicates that the conditional formatting is associated with a PivotTable
Type case propterty for the base class.
IExcelConditionalFormattingStdDevGroup
IExcelConditionalFormattingThreeColorScale
Three Color Scale Middle Value
IExcelConditionalFormattingThreeIconSet
Icon1 (part of the 3, 4 or 5 Icon Set)
Icon2 (part of the 3, 4 or 5 Icon Set)
Icon3 (part of the 3, 4 or 5 Icon Set)
IExcelConditionalFormattingTimePeriod
IExcelConditionalFormattingTopBottomGroup
IExcelConditionalFormattingTwoColorScale
Two Color Scale Low Value
Two Color Scale High Value
IExcelConditionalFormattingUniqueValues
IExcelConditionalFormattingWithFormula
Formula Attribute
IExcelConditionalFormattingWithFormula2
Formula2 Attribute
IExcelConditionalFormattingWithRank
Rank Attribute
IExcelConditionalFormattingWithReverse
Reverse Attribute
IExcelConditionalFormattingWithShowValue
ShowValue Attribute
IExcelConditionalFormattingWithStdDev
StdDev Attribute
IExcelConditionalFormattingWithText
Text Attribute
Provides functionality for adding Conditional Formatting to a range ().
Each method will return a configurable condtional formatting type.
Adds an Above Average rule to the range
Adds an Above Or Equal Average rule to the range
Adds a Below Average rule to the range
Adds a Below Or Equal Average rule to the range
Adds an Above StdDev rule to the range
Adds an Below StdDev rule to the range
Adds a Bottom rule to the range
Adds a Bottom Percent rule to the range
Adds a Top rule to the range
Adds a Top Percent rule to the range
Adds a Last 7 Days rule to the range
Adds a Last Month rule to the range
Adds a Last Week rule to the range
Adds a Next Month rule to the range
Adds a Next Week rule to the range
Adds a This Month rule to the range
Adds a This Week rule to the range
Adds a Today rule to the range
Adds a Tomorrow rule to the range
Adds an Yesterday rule to the range
Adds a Begins With rule to the range
Adds a Between rule to the range
Adds a ContainsBlanks rule to the range
Adds a ContainsErrors rule to the range
Adds a ContainsText rule to the range
Adds a DuplicateValues rule to the range
Adds an EndsWith rule to the range
Adds an Equal rule to the range
Adds an Expression rule to the range
Adds a GreaterThan rule to the range
Adds a GreaterThanOrEqual rule to the range
Adds a LessThan rule to the range
Adds a LessThanOrEqual rule to the range
Adds a NotBetween rule to the range
Adds a NotContainsBlanks rule to the range
Adds a NotContainsErrors rule to the range
Adds a NotContainsText rule to the range
Adds a NotEqual rule to the range
Adds an UniqueValues rule to the range
Adds a to the range
Adds a to the range
Adds a to the range
Adds a to the range
Adds a to the range
Adds a to the range
Get a list of all conditional formatting rules that exist on cells in the range
Provides a simple way to type cast a conditional formatting object to its top level class.
Converts the conditional formatting object to it's top level or another nested class.
The type of conditional formatting object. T must be inherited from IExcelConditionalFormattingRule
The conditional formatting rule as type T
Returns the conditional formatting object as an Average rule
If this object is not of type AboveAverage, AboveOrEqualAverage, BelowAverage or BelowOrEqualAverage, null will be returned
The conditional formatting rule as an Average rule
Returns the conditional formatting object as a StdDev rule
If this object is not of type AboveStdDev or BelowStdDev, null will be returned
The conditional formatting object as a StdDev rule
Returns the conditional formatting object as a TopBottom rule
If this object is not of type Bottom, BottomPercent, Top or TopPercent, null will be returned
The conditional formatting object as a TopBottom rule
Returns the conditional formatting object as a DateTimePeriod rule
If this object is not of type Last7Days, LastMonth, LastWeek, NextMonth, NextWeek, ThisMonth, ThisWeek, Today, Tomorrow or Yesterday, null will be returned
The conditional formatting object as a DateTimePeriod rule
Returns the conditional formatting object as a Between rule
If this object is not of type Between, null will be returned
The conditional formatting object as a Between rule
Returns the conditional formatting object as a ContainsBlanks rule
If this object is not of type ContainsBlanks, null will be returned
The conditional formatting object as a ContainsBlanks rule
Returns the conditional formatting object as a ContainsErrors rule
If this object is not of type ContainsErrors, null will be returned
The conditional formatting object as a ContainsErrors rule
Returns the conditional formatting object as a ContainsText rule
If this object is not of type ContainsText, null will be returned
The conditional formatting object as a ContainsText rule
Returns the conditional formatting object as a NotContainsBlanks rule
If this object is not of type NotContainsBlanks, null will be returned
The conditional formatting object as a NotContainsBlanks rule
Returns the conditional formatting object as a NotContainsText rule
If this object is not of type NotContainsText, null will be returned
The conditional formatting object as a NotContainsText rule
Returns the conditional formatting object as a NotContainsErrors rule
If this object is not of type NotContainsErrors, null will be returned
The conditional formatting object as a NotContainsErrors rule
Returns the conditional formatting object as a NotBetween rule
If this object is not of type NotBetween, null will be returned
The conditional formatting object as a NotBetween rule
Returns the conditional formatting object as an Equal rule
If this object is not of type Equal, null will be returned
The conditional formatting object as an Equal rule
Returns the conditional formatting object as a NotEqual rule
If this object is not of type NotEqual, null will be returned
The conditional formatting object as a NotEqual rule
Returns the conditional formatting object as a DuplicateValues rule
If this object is not of type DuplicateValues, null will be returned
The conditional formatting object as a DuplicateValues rule
Returns the conditional formatting object as a BeginsWith rule
If this object is not of type BeginsWith, null will be returned
The conditional formatting object as a BeginsWith rule
Returns the conditional formatting object as an EndsWith rule
If this object is not of type EndsWith, null will be returned
The conditional formatting object as an EndsWith rule
Returns the conditional formatting object as an Expression rule
If this object is not of type Expression, null will be returned
The conditional formatting object as an Expression rule
Returns the conditional formatting object as a GreaterThan rule
If this object is not of type GreaterThan, null will be returned
The conditional formatting object as a GreaterThan rule
Returns the conditional formatting object as a GreaterThanOrEqual rule
If this object is not of type GreaterThanOrEqual, null will be returned
The conditional formatting object as a GreaterThanOrEqual rule
Returns the conditional formatting object as a LessThan rule
If this object is not of type LessThan, null will be returned
The conditional formatting object as a LessThan rule
Returns the conditional formatting object as a LessThanOrEqual rule
If this object is not of type LessThanOrEqual, null will be returned
The conditional formatting object as a LessThanOrEqual rule
Returns the conditional formatting object as a UniqueValues rule
If this object is not of type UniqueValues, null will be returned
The conditional formatting object as a UniqueValues rule
Returns the conditional formatting object as a TwoColorScale rule
If this object is not of type TwoColorScale, null will be returned
The conditional formatting object as a TwoColorScale rule
Returns the conditional formatting object as a ThreeColorScale rule
If this object is not of type ThreeColorScale, null will be returned
The conditional formatting object as a ThreeColorScale rule
Returns the conditional formatting object as a ThreeIconSet rule
If this object is not of type ThreeIconSet, null will be returned
The conditional formatting object as a ThreeIconSet rule
Returns the conditional formatting object as a FourIconSet rule
If this object is not of type FourIconSet, null will be returned
The conditional formatting object as a FourIconSet rule
Returns the conditional formatting object as a FiveIconSet rule
If this object is not of type FiveIconSet, null will be returned
The conditional formatting object as a FiveIconSet rule
Returns the conditional formatting object as a DataBar rule
If this object is not of type DataBar, null will be returned
The conditional formatting object as a DataBar rule
Collection of all ConditionalFormattings in the workbook
Read conditionalFormatting info from extLst in xml via xr reader
Index operator, returns by 0-based index
Number of validations
Removes all 'cfRule' from the collection and from the XML.
This is the same as removing all the 'conditionalFormatting' nodes.
Remove a Conditional Formatting Rule by its object
Remove a Conditional Formatting Rule by its 0-based index
Remove a Conditional Formatting Rule by its priority
Get a rule by its priority
Add rule (internal)
Add GreaterThan Rule
Add GreaterThan Rule
Add LessThan Rule
Add LessThan Rule
Add between rule
Add between rule
Add Equal rule
Add Equal rule
Add TextContains rule
Add TextContains rule
Add Yesterday rule
Add Yesterday rule
Add Today rule
Add Today rule
Add Tomorrow rule
Add Tomorrow rule
Add Last7Days rule
Add Last7Days rule
Add lastWeek rule
Add lastWeek rule
Add this week rule
Add this week rule
Add next week rule
Add next week rule
Add last month rule
Add last month rule
Add ThisMonth rule
Add ThisMonth rule
Add NextMonth rule
Add NextMonth rule
Add DuplicateValues Rule
Add DuplicateValues Rule
Add Bottom Rule
Add Bottom Rule
Add BottomPercent Rule
Add BottomPercent Rule
Add Top Rule
Add Top Rule
Add TopPercent Rule
Add TopPercent Rule
Add AboveAverage Rule
Add AboveAverage Rule
String must be a valid excelAddress
Add AboveOrEqualAverage Rule
Add AboveOrEqualAverage Rule
Add BelowAverage Rule
Add BelowAverage Rule
Add BelowOrEqualAverage Rule
Add BelowOrEqualAverage Rule
Add AboveStdDev Rule
Add AboveStdDev Rule
Add BelowStdDev Rule
Add BelowStdDev Rule
Add BeginsWith Rule
Add BeginsWith Rule
Add ContainsBlanks Rule
Add ContainsBlanks Rule
Add ContainsErrors Rule
Add ContainsErrors Rule
Add ContainsText Rule
Add ContainsText Rule
Add EndsWith Rule
Add EndsWith Rule
Add Expression Rule
Add Expression Rule
Add GreaterThanOrEqual Rule
Add GreaterThanOrEqual Rule
Add LessThanOrEqual Rule
Add LessThanOrEqual Rule
Add NotBetween Rule
Add NotBetween Rule
Add NotContainsBlanks Rule
Add NotContainsBlanks Rule
Add NotContainsErrors Rule
Add NotContainsErrors Rule
Add NotContainsText Rule
Add NotContainsText Rule
Add NotEqual Rule
Add NotEqual Rule
Add Unique Rule
Add Unique Rule
Add ThreeColorScale Rule
Add ThreeColorScale Rule
Add TwoColorScale Rule
Add TwoColorScale Rule
Add ThreeIconSet Rule
The address
Type of iconset
Add ThreeIconSet Rule
The address
Type of iconset
Adds a FourIconSet rule
Adds a FourIconSet rule
Adds a FiveIconSet rule
Adds a FiveIconSet rule
Adds a databar rule
Adds a databar rule
The value type
Used to set color or theme color, index, auto and tint
The color to be used
The value of the conditional formatting
The Formula of the Object Value
Keep in mind that Addresses in this property should be Absolute not relative
Yes: $A$1
No: A1
The conditional formatting constants
Enum for Conditional Format Type ST_CfType §18.18.12. With some changes.
Highlights cells that are above the average for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are above or equal to the average for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are below the average for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are below or equal to the average for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are above the standard deviation for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are below the standard deviation for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells whose values fall in the bottom N bracket as specified.
Top10 Excel CF Rule Type
Highlights cells whose values fall in the bottom N percent as specified.
Top10 Excel CF Rule Type
Highlights cells whose values fall in the top N bracket as specified.
Top10 Excel CF Rule Type
Highlights cells whose values fall in the top N percent as specified.
Top10 Excel CF Rule Type
Highlights cells containing dates in the last 7 days.
TimePeriod Excel CF Rule Type
Highlights cells containing dates in the last month.
TimePeriod Excel CF Rule Type
Highlights cells containing dates in the last week.
TimePeriod Excel CF Rule Type
Highlights cells containing dates in the next month.
TimePeriod Excel CF Rule Type
Highlights cells containing dates in the next week.
TimePeriod Excel CF Rule Type
Highlights cells containing dates in this month.
TimePeriod Excel CF Rule Type
Highlights cells containing dates in this week.
TimePeriod Excel CF Rule Type
Highlights cells containing todays date.
TimePeriod Excel CF Rule Type
Highlights cells containing tomorrows date.
TimePeriod Excel CF Rule Type
Highlights cells containing yesterdays date.
TimePeriod Excel CF Rule Type
Highlights cells in the range that begin with the given text.
Equivalent to using the LEFT() sheet function and comparing values.
BeginsWith Excel CF Rule Type
Highlights cells in the range between the given two formulas.
CellIs Excel CF Rule Type
Highlights cells that are completely blank.
Equivalent of using LEN(TRIM()). This means that if the cell contains only
characters that TRIM() would remove, then it is considered blank. An empty cell
is also considered blank.
ContainsBlanks Excel CF Rule Type
Highlights cells with formula errors.
Equivalent to using ISERROR() sheet function to determine if there is
a formula error.
ContainsErrors Excel CF Rule Type
Highlights cells in the range that begin with
the given text.
Equivalent to using the LEFT() sheet function and comparing values.
ContainsText Excel CF Rule Type
Highlights duplicated values.
DuplicateValues Excel CF Rule Type
Highlights cells ending with the given text.
Equivalent to using the RIGHT() sheet function and comparing values.
EndsWith Excel CF Rule Type
Highlights cells equal to the given formula.
CellIs Excel CF Rule Type
This rule contains a formula to evaluate. When the formula result is true, the cell is highlighted.
Expression Excel CF Rule Type
Highlights cells greater than the given formula.
CellIs Excel CF Rule Type
Highlights cells greater than or equal the given formula.
CellIs Excel CF Rule Type
Highlights cells less than the given formula.
CellIs Excel CF Rule Type
Highlights cells less than or equal the given formula.
CellIs Excel CF Rule Type
Highlights cells outside the range in given two formulas.
CellIs Excel CF Rule Type
Highlights cells that does not contains the given formula.
CellIs Excel CF Rule Type
Highlights cells that are not blank.
Equivalent of using LEN(TRIM()). This means that if the cell contains only
characters that TRIM() would remove, then it is considered blank. An empty cell
is also considered blank.
NotContainsBlanks Excel CF Rule Type
Highlights cells without formula errors.
Equivalent to using ISERROR() sheet function to determine if there is a
formula error.
NotContainsErrors Excel CF Rule Type
Highlights cells that do not contain the given text.
Equivalent to using the SEARCH() sheet function.
NotContainsText Excel CF Rule Type
.
CellIs Excel CF Rule Type
Highlights unique values in the range.
UniqueValues Excel CF Rule Type
Three Color Scale (Low, Middle and High Color Scale)
ColorScale Excel CF Rule Type
Two Color Scale (Low and High Color Scale)
ColorScale Excel CF Rule Type
This conditional formatting rule applies a 3 set icons to cells according
to their values.
IconSet Excel CF Rule Type
This conditional formatting rule applies a 4 set icons to cells according
to their values.
IconSet Excel CF Rule Type
This conditional formatting rule applies a 5 set icons to cells according
to their values.
IconSet Excel CF Rule Type
This conditional formatting rule displays a gradated data bar in the range of cells.
DataBar Excel CF Rule Type
Enum for Conditional Format Value Object Type ST_CfvoType §18.18.13
Formula
Maximum Value
Minimum Value
Number Value
Percent
Percentile
Auto minimal value
Auto Maximum value
Enum for Conditional Formatting Value Object Position
The lower position for both TwoColorScale and ThreeColorScale
The middle position only for ThreeColorScale
The highest position for both TwoColorScale and ThreeColorScale
Enum for Conditional Formatting Value Object Node Type
'cfvo' node
'color' node
Enum for Conditional Formatting Operartor Type ST_ConditionalFormattingOperator §18.18.15
Begins With. 'Begins with' operator
Between. 'Between' operator
Contains. 'Contains' operator
Ends With. 'Ends with' operator
Equal. 'Equal to' operator
Greater Than. 'Greater than' operator
Greater Than Or Equal. 'Greater than or equal to' operator
Less Than. 'Less than' operator
Less Than Or Equal. 'Less than or equal to' operator
Not Between. 'Not between' operator
Does Not Contain. 'Does not contain' operator
Not Equal. 'Not equal to' operator
Enum for Conditional Formatting Time Period Type ST_TimePeriod §18.18.82
Last 7 Days. A date in the last seven days.
Last Month. A date occuring in the last calendar month.
Last Week. A date occuring last week.
Next Month. A date occuring in the next calendar month.
Next Week. A date occuring next week.
This Month. A date occuring in this calendar month.
This Week. A date occuring this week.
Today. Today's date.
Tomorrow. Tomorrow's date.
Yesterday. Yesterday's date.
18.18.42 ST_IconSetType (Icon Set Type) - Only 3 icons
3 arrows icon set.
3 gray arrows icon set.
3 flags icon set.
3 signs icon set.
3 symbols icon set.
3 Symbols icon set.
3 traffic lights icon set (#1).
3 traffic lights icon set with thick black border.
3 stars icon set.
3 triangles icon set.
18.18.42 ST_IconSetType (Icon Set Type) - Only 4 icons
(4 Arrows) 4 arrows icon set.
(4 Arrows (Gray)) 4 gray arrows icon set.
(4 Ratings) 4 ratings icon set.
(4 Red To Black) 4 'red to black' icon set.
(4 Traffic Lights) 4 traffic lights icon set.
18.18.42 ST_IconSetType (Icon Set Type) - Only 5 icons
5 arrows icon set.
5 gray arrows icon set.
5 quarters icon set.
5 rating icon set.
5 rating icon set.
18.18.42 ST_IconSetType (Icon Set Type)
3 arrows icon set
3 gray arrows icon set
3 flags icon set.
3 signs icon set.
3 symbols icon set.
3 Symbols icon set.
3 traffic lights icon set (#1).
3 traffic lights icon set with thick black border.
4 arrows icon set.
4 gray arrows icon set.
4 ratings icon set.
4 'red to black' icon set.
4 traffic lights icon set.
5 arrows icon set.
5 gray arrows icon set.
5 quarters icon set.
5 rating icon set.
Enum of all icons for custom iconsets
Red down arrow.
Yellow side arrow.
Green up arrow.
Gray down arrow.
Gray side arrow.
Gray up arrow.
Red flag.
Yellow flag.
Green flag.
Red Circle.
Yellow Circle.
Green Circle.
Red Traffic Light.
Yellow Traffic Light.
Green Traffic Light.
Red Diamond
Yellow Triangle.
Red Cross Symbol
Yellow Exclamation Symbol
Green Check Symbol
Red Cross
Yellow Exclamation
Green Check
Empty/Silver Star
Half-Filled Gold Star
Gold Star
Red Down Triangle
Yellow Dash
Green Up Triangle
Yellow down incline arrow
Yellow up incline arrow
Gray down incline arrow
Gray up incline arrow
Black circle
Gray circle
Pink circle
Red circle
Sigmal icon with 1 blue bar
Sigmal icon with 2 blue bars
Sigmal icon with 3 blue bars
Sigmal icon with 4 blue bars
Black Circle from 4TrafficLights
Empty Signal Meter
White Circle (All White Quarters)
Circle with three white quarters
Circle with two white quarters
Circle with one white quarter
Zero filled boxes
One filled box
Two filled boxes
Three filled boxes
Four filled boxes
No/Invisible Icon
The position of the axis between positive and negative numbers on databar
(Display at a variable position based on negative values.)
This is the default.
Always put the axis at the cell midpoint.
Show negative values bars in the same direction as positive.
Conditional formatting rule types valid for pivot tables.
Highlights cells that are above the average for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are above or equal to the average for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are below the average for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are below or equal to the average for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are above the standard deviation for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells that are below the standard deviation for all values in the range.
AboveAverage Excel CF Rule Type
Highlights cells whose values fall in the bottom N bracket as specified.
Top10 Excel CF Rule Type
Highlights cells whose values fall in the bottom N percent as specified.
Top10 Excel CF Rule Type
Highlights cells whose values fall in the top N bracket as specified.
Top10 Excel CF Rule Type
Highlights cells whose values fall in the top N percent as specified.
Top10 Excel CF Rule Type
Highlights cells in the range between the given two formulas.
CellIs Excel CF Rule Type
Highlights cells that are completely blank.
Equivalent of using LEN(TRIM()). This means that if the cell contains only
characters that TRIM() would remove, then it is considered blank. An empty cell
is also considered blank.
ContainsBlanks Excel CF Rule Type
Highlights cells with formula errors.
Equivalent to using ISERROR() sheet function to determine if there is
a formula error.
ContainsErrors Excel CF Rule Type
Highlights cells equal to the given formula.
CellIs Excel CF Rule Type
This rule contains a formula to evaluate. When the formula result is true, the cell is highlighted.
Expression Excel CF Rule Type
Highlights cells greater than the given formula.
CellIs Excel CF Rule Type
Highlights cells greater than or equal the given formula.
CellIs Excel CF Rule Type
Highlights cells less than the given formula.
CellIs Excel CF Rule Type
Highlights cells less than or equal the given formula.
CellIs Excel CF Rule Type
Highlights cells outside the range in given two formulas.
CellIs Excel CF Rule Type
Highlights cells that are not blank.
Equivalent of using LEN(TRIM()). This means that if the cell contains only
characters that TRIM() would remove, then it is considered blank. An empty cell
is also considered blank.
NotContainsBlanks Excel CF Rule Type
Highlights cells without formula errors.
Equivalent to using ISERROR() sheet function to determine if there is a
formula error.
NotContainsErrors Excel CF Rule Type
.
CellIs Excel CF Rule Type
Three Color Scale (Low, Middle and High Color Scale)
ColorScale Excel CF Rule Type
Two Color Scale (Low and High Color Scale)
ColorScale Excel CF Rule Type
This conditional formatting rule applies a 3 set icons to cells according
to their values.
IconSet Excel CF Rule Type
This conditional formatting rule applies a 4 set icons to cells according
to their values.
IconSet Excel CF Rule Type
This conditional formatting rule applies a 5 set icons to cells according
to their values.
IconSet Excel CF Rule Type
This conditional formatting rule displays a gradated data bar in the range of cells.
DataBar Excel CF Rule Type
Conditional formatting helper
Check and fix an address (string address)
Convert a color code to Color Object
Color Code (Ex. "#FFB43C53" or "FFB43C53")
Encode to XML (special characteres: ' " > < &)
Decode from XML (special characteres: ' " > < &)
18.3.1.11 cfvo (Conditional Format Value Object)
Describes the values of the interpolation points in a gradient scale.
If not custom is null. If user assigns to it holds icon value.
Rule type
Value type
Greater Than Or Equal To
Set to false to only apply an icon when greaterThan
The value
The Formula of the Object Value
Keep in mind that Addresses in this property should be Absolute not relative
Yes: $A$1
No: A1
IconSet base class
Settings for icon 1 in the iconset
Settings for icon 2 in the iconset
Settings for icon 2 in the iconset
Reverse the order of the icons
Default false
If its percent
default true
If the cell values are visible
default true
Functions related to the ExcelConditionalFormattingRule
Add AboveOrEqualAverage Conditional Formatting
Add AboveOrEqualAverage Conditional Formatting
Add BelowOrEqualAverage Conditional Formatting
Add BelowOrEqualAverage Conditional Formatting
Add AboveStdDev Conditional Formatting
Add BelowStdDev Conditional Formatting
Add Bottom Conditional Formatting
Add BottomPercent Conditional Formatting
Add Top Conditional Formatting
Add TopPercent Conditional Formatting
Add Last7Days Conditional Formatting
Add LastMonth Conditional Formatting
Add LastWeek Conditional Formatting
Add NextMonth Conditional Formatting
Add NextWeek Conditional Formatting
Add ThisMonth Conditional Formatting
Add ThisWeek Conditional Formatting
Add Today Conditional Formatting
Add Tomorrow Conditional Formatting
Add Yesterday Conditional Formatting
Add BeginsWith Conditional Formatting
Add Between Conditional Formatting
Add ContainsBlanks Conditional Formatting
Add ContainsErrors Conditional Formatting
Add ContainsText Conditional Formatting
Add DuplicateValues Conditional Formatting
Add EndsWith Conditional Formatting
Add Equal Conditional Formatting
Add Expression Conditional Formatting
Add GreaterThan Conditional Formatting
Add GreaterThanOrEqual Conditional Formatting
Add LessThan Conditional Formatting
Add LessThanOrEqual Conditional Formatting
Add NotBetween Conditional Formatting
Add NotContainsBlanks Conditional Formatting
Add NotContainsErrors Conditional Formatting
Add NotContainsText Conditional Formatting
Add NotEqual Conditional Formatting
Add UniqueValues Conditional Formatting
Add ThreeColorScale Conditional Formatting
Add TwoColorScale Conditional Formatting
Adds a ThreeIconSet rule
Adds a FourIconSet rule
Adds a FiveIconSet rule
Adds a Databar rule
The color of the databar
Icon 4 value
Icon 4 value
Icon 4 value
Direction of Databar
Based on context
Databar going from left to right
Databar going RighToLeft
For reading all Databar CT_Colors Recursively until we hit a non-color node.
To force the color to write to. Useful e.g. when loading the local databar node that denotes fill color is just named Color
Show value
Databar Low Value
Databar High Value
Shorthand for the Fillcolor.Color property as it is the most commonly used
The text to search in the end of the cell
ExcelConditionalFormattingLast7Days
ExcelConditionalFormattingLast7Days
ExcelConditionalFormattingLast7Days
ExcelConditionalFormattingLast7Days
ExcelConditionalFormattingLast7Days
Abstract base class for all ConditionalFormattingRules
The type of conditional formatting rule.
The range over which these conditional formatting rules apply.
The priority of the rule.
1 is highest priority. 2 second highest etc.
If this property is true, no rules with lower priority should be applied over this rule.
Indicates that the conditional formatting is associated with a PivotTable
The style
0 is not allowed and will be converted to 1
Rank (zero is not allowed and will be converted to 1)
Internal worksheet reference
The DxfId (Differential Formatting style id)
Initalize from file
Copy constructor
In case cloning from another worksheet
Initalize from variables
Above average
In Excel: Default:True, use=optional
EqualAverage
Bottom attribute
Percent attribute
TimePeriod
Operator
Formula
Formula2
Note, no longer Requires Formula to be set before it.
But will still throw error if both formulas not filled at save time.
Provides access to type conversion for all conditional formatting rules.
ExcelConditionalFormattingLast7Days
ExcelConditionalFormattingLast7Days
The middle value.
ExcelConditionalFormattingTimePeriodGroup
ExcelConditionalFormattingLast7Days
ExcelConditionalFormattingLast7Days
Two Colour Scale class
Internal Reading function
Low Value for Two Color Scale Object Value
High Value for Two Color Scale Object Value
ExcelConditionalFormattingLast7Days
Parameters for configuring the class before usage
If set to true errors/exceptions that occurs during initialization of the ExcelPackage class will
be suppressed and logged in .
If set to false these Exceptions will be rethrown.
Default value of this property is false.
Path of the directory where the json configuration file is located.
Default value is the path returned from
File name of the json configuration file.
Default value is appsettings.json
Configuration with default values.
Resets configuration to its default values
These binary search functions are identical, except that one uses a struc and the other a class.
Structs consume less memory and are also faster.
For the struct.
For testing purpose only. Can be removed when cell store is fully optimized.
This is the store for all Rows, Columns and Cells.
It is a Dictionary implementation that allows you to change the Key.
Rows and Column data is stored in column with index 0(row data) and row with index 0 (column data).
For internal use only.
Must be set before any instance of the CellStore is created.
Delete a number of rows from a specific row
The first row to delete
Number of rows
If rows are shifted upwards
The column index
The page position
From row
Number of rows
The column index
The page position
Shift cells or not
Return rows left to delete, for DeleteCells
Add a new page to the collection
The column
Position
The new page object to add
Add a new page to the collection
The column
Position
Before enumerating columns where values are set to the cells store,
this method makes sure the columns are created before the enumerator is created, so the positions will not get out of sync when a new column is added.
From column
To Column
This class represents
For cell value structure (for memory optimization of huge sheet)
Rows in the rows collection.
First row index minus last row index
This class stores ranges to keep track if they have been accessed before and adds a reference to .
Returns empty array if no result because fromRow, toRow covers entire spane
Returns rangeItem with rowspan -1 if the item does not exist within fromRow ToRow
This class stores ranges to keep track if they have been accessed before.
Merge will add the range and return any part not added before.
Merge the cell into the existing data and returns the ranges added.
A readonly collection of a generic type
The generic type
Return the enumerator for the collection
The indexer for the collection
The index
Returns the object at the index
Retrives the index of the supplied value
The index
Number of items in the collection.
Translate addresses between the R1C1 and A1 notation
Translate addresses in a formula from R1C1 to A1
The formula
The row of the cell to calculate from
The column of the cell to calculate from
If row or col exceeds the maximum value the row/col will start over from 1
The formula in A1 notation
Translate addresses in a formula from A1 to R1C1
The formula
The row of the cell to calculate from
The column of the cell to calculate from
The formula in R1C1 notation
Translate an address from R1C1 to A1
The address
The row of the cell to calculate from
The column of the cell to calculate from
If row or col exceeds the maximum value the row/col will start over from 1
The address in A1 notation
Translate an address from A1 to R1C1
The address
The row of the cell to calculate from
The column of the cell to calculate from
The address in R1C1 notation
Ranges intersecting with this quad.
Parameters for the method
The start value. If null, the first value in the row/column is used.
When this value is exceeded the fill stops
The value to add for each step.
The date unit added per cell
Only fill weekdays
Excludes the week days supplied
The excluded week days
A list with week days treated as holidays.
Excludes the dates supplied
The dates treated as week days
Excludes the dates supplied
The dates treated as week days
Parameters for the method
The start index in the list.
Parameters for the method
The start value. If null, the first value in the row/column is used.
When this value is exceeded the fill stops
The value to use in the calculation for each step.
The calculation method to use
Shared base class for Fill-methods
If the fill starts from the top-left cell or the bottom right cell.
The direction of the fill
The number format to be appled to the range.
The binary files created for text measurements of various font families just contains
approximations of the characters where the carachters are divided into a number of width
classes. This alone is not enough to get close enough to a good result.
This class contains various scaling factors used to get the text measurements as close
as the spreadsheet applications GUI as possible.
Unicode ranges to cover Japanese/Kanji characters
Loads serialized font metrics
Loads all serialized font metrics from the resources/SerializedFonts.zip archive
Measures the supplied text
The text to measure
Font of the text to measure
A
Constructor
Replaces placeholder nodes by writing the system's held information
The streamwriter file info is written to
The original XML
Start position of the current node
End position of the current node
Inserts the cols collection into the XML document
Check all Shared formulas that the first cell has not been deleted.
If so create a standard formula of all cells in the formula .
Insert row and cells into the XML document
Update merged cells
The writer
Namespace prefix for the main schema
Update xml with hyperlinks
The stream
The namespace prefix for the main schema
ExtLst updater for DataValidations
Calculation Method for number fill operations
Add the value to the next fill
Multiply the value to the next fill
The date units for date fill operations
Adds a Year
Adds a Month
Adds 7 Days
Adds a Day
Adds an Hour
Adds a Minute
Adds a Second
Adds ticks
If the fill is performed Down/Up (Column) or Left/Right (Row).
Also see
The fill is performed row-wise
The fill is performed column-wise
If the fill starts from the top-left cell or the bottom-right cell.
Also see
The fill starts from the top-left cell and fills to the left and down depending on the
The fill starts from the bottom-right cell and fills to the right and up depending on the
Inserts content after the uriNode
Note that this is only intended to be done once per type of node and it will throw error
if the same uri is attempted in two separate calls or if it's already been read in initally.
If is blank sets content as the first ext
A generic interface for all data validations. Specialized implementation interfaces should inherit this interface.
Unique id of the data validation
Address of data validation
Validation type
Controls how Excel will handle invalid values.
True if input message should be shown
True if input message should be shown
True if error message should be shown.
Title of error message box (see property ShowErrorMessage)
Error message box text (see property ShowErrorMessage)
Title of info box if input message should be shown (see property ShowInputMessage)
Info message text (see property ShowErrorMessage)
True if the current validation type allows operator.
Validates the state of the validation.
Use this property to cast an instance of to its subtype, see .
Defines mode for Input Method Editor used in east-asian languages
Indicates whether this instance is stale, see https://github.com/EPPlusSoftware/EPPlus/wiki/Data-validation-Exceptions
Data validation interface for Any value validation.
Data validation interface for custom validation.
Validation interface for datetime validations
Data validation interface for decimal values
Interface for a datavalidation for an integer value (whole validation in Excel)
Interface for a data validation list
True if an in-cell dropdown should be hidden.
This property corresponds to the showDropDown attribute of a data validation in Office Open Xml. Strangely enough this
attributes hides the in-cell dropdown if it is true and shows the dropdown if it is not present or false. We have checked
this in both Ms Excel and Google sheets and it seems like this is how it is implemented in both applications. Hence why we have
renamed this property to HideDropDown since that better corresponds to the functionality.
Data validation interface for time validation.
Interface for a datavalidation with an excel formula
An instance implementing the interface.
Formula of the validation
Interface for a data validation with two formulas
Formula 2
Represents a validation with an operator
Operator type
Sets isExtLst flag
Abstract base class for all Excel datavalidations. Contains functionlity which is common for all these different validation types.
Constructor
Id for validation
adress validation is applied to
The worksheet
Read-File Constructor
The worksheet
Copy-Constructor
Validation to copy from
The worksheet
Uid of the data validation
Address of data validation
Validation type
Warning style
Mode for east-asian languages who use Input Method Editors(IME)
True if blanks should be allowed
True if input message should be shown
True if error message should be shown
Title of error message box
Error message box text
Title of the validation message box.
Text of the validation message box.
True if the current validation type allows operator.
This method will validate the state of the validation
If the state breaks the rules of the validation
Us this property to case s to its subtypes
Indicates whether this instance is stale, see https://github.com/EPPlusSoftware/EPPlus/wiki/Data-validation-Exceptions
DEPRECATED as of Epplus 6.2.
This as validations can no longer be stale since all attributes are now always fresh and held in the system.
Operator for comparison between the entered value and Formula/Formulas.
Type to determine if extLst or not
Event method for changing internal type when referring to an external worksheet.
Create a Deep-Copy of this validation.
Note that one should also implement a separate clone() method casting to the child class
Create a Deep-Copy of this validation.
Note that one should also implement a separate clone() method casting to the child class
Handling for ExcelAdress updates of DataValidations
Called before the address changes
Called when the address changes
Any value validation.
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
The worksheet
Constructor for reading data
The XmlReader to read from
Copy constructor
The worksheet
True if the current validation type allows operator.
Validation type
Provides a simple way to type cast a data validation object to its actual class.
Converts the data validation object to it's implementing class or any of the abstract classes/interfaces inheriting the interface.
The type of datavalidation object. T must be inherited from
An instance of or null if type casting fails.
Returns the data validation object as
The data validation as an or null if typecasting fails
Returns the data validation object as
The data validation as an or null if typecasting fails
Returns the data validation object as
The data validation as an or null if typecasting fails
Returns the data validation object as
The data validation as an or null if typecasting fails
Returns the data validation object as
The data validation as an or null if typecasting fails
Returns the data validation object as
The data validation as an or null if typecasting fails
Returns the data validation object as
The data validation as an or null if typecasting fails
Collection of . This class is providing the API for EPPlus data validation.
The public methods of this class (Add[...]Validation) will create a datavalidation entry in the worksheet. When this
validation has been created changes to the properties will affect the workbook immediately.
Each type of validation has either a formula or a typed value/values, except for custom validation which has a formula only.
// Add a date time validation
var validation = worksheet.DataValidation.AddDateTimeValidation("A1");
// set validation properties
validation.ShowErrorMessage = true;
validation.ErrorTitle = "An invalid date was entered";
validation.Error = "The date must be between 2011-01-31 and 2011-12-31";
validation.Prompt = "Enter date here";
validation.Formula.Value = DateTime.Parse("2011-01-01");
validation.Formula2.Value = DateTime.Parse("2011-12-31");
validation.Operator = ExcelDataValidationOperator.between;
Read data validation from xml via xr reader
Validates address - not empty, collisions
Validates all data validations.
Optionally add address at end for new copy with address in range
Adds a to the worksheet.
The range/address to validate
Adds an to the worksheet. Whole means that the only accepted values
are integer values.
the range/address to validate
Adds an regarding text length to the worksheet.
The range/address to validate
Addes an to the worksheet. The only accepted values are
decimal values.
The range/address to validate
Adds an to the worksheet. The accepted values are defined
in a list.
The range/address to validate
Adds an to the worksheet.
The range/address to validate
Adds an to the worksheet.
The range/address to validate
Adds a to the worksheet.
The range/address to validate
Number of validations
3
Epplus validates that all data validations are consistend and valid
when they are added and when a workbook is saved. Since this takes some
resources, it can be disabled for improve performance.
Index operator, returns by 0-based index
Index operator, returns a data validation which address partly or exactly matches the searched address.
A cell address or range
A or null if no match
Returns all validations that matches the supplied predicate .
predicate to filter out matching validations
Removes an from the collection.
The item to remove
True if remove succeeds, otherwise false
if is null
Returns the first matching validation.
Removes all validations from the collection.
Removes the validations that matches the predicate
Custom validation, i.e. a formula.
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
Constructor for reading data
The XmlReader to read from
The worksheet
Copy constructor
The worksheet
Property for determining type of validation
Validation for .
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
The worksheet
Constructor for reading data
The XmlReader to read from
The worksheet
Copy constructor
The worksheet
Property for determining type of validation
Data validation for decimal values
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
Constructor for reading data
The XmlReader to read from
The worksheet
Copy constructor
The worksheet
Property for determining type of validation
Factory class for ExcelDataValidation.
Creates an instance of out of the reader.
"
The worksheet
Mode for east-asian languages who use Input Method Editors(IME)
Default. Has no effect on IME
Forces IME mode to OFF
Forces the IMEmode to be on when first selecting the cell
IME mode is disabled when cell is selected
Forces on and Hiragana (only applies if Japanese IME)
Forces on and full-width katakana
Forces on and half-width katakana
Forces on and Alpha-Numeric IME
Forces on and half-width alpha-numeric
Forces on and Full-width Hangul if Korean IME
Forces on and half-width Hangul
Data validation for integer values.
Constructor for reading data
The XmlReader to read from
The worksheet
Bool to define type of int validation
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
Bool to define type of int validation
Copy constructor
The worksheet
Property for determining type of validation
Return a deep-copy clone of validation
This class represents an List data validation.
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
Constructor for reading data
The XmlReader to read from
The worksheet
Copy constructor
The worksheet
Read-Only property for seeing if this dataValidation type has an operator.
Property for determining type of validation
True if an in-cell dropdown should be hidden.
This property corresponds to the showDropDown attribute of a data validation in Office Open Xml. Strangely enough this
attributes hides the in-cell dropdown if it is true and shows the dropdown if it is not present or false. We have checked
this in both Ms Excel and Google sheets and it seems like this is how it is implemented in both applications. Hence why we have
renamed this property to HideDropDown since that better corresponds to the functionality.
Validate the validation
Operator for comparison between Formula and Formula2 in a validation.
The value of the validated cell should be between two values
The value of the validated cell should be eqal to a specific value
The value of the validated cell should be greater than a specific value
The value of the validated cell should be greater than or equal to a specific value
The value of the validated cell should be less than a specific value
The value of the validated cell should be less than or equal to a specific value
The value of the validated cell should not be between two specified values
The value of the validated cell should not be eqal to a specific value
Validation for times ().
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
Constructor for reading data
The XmlReader to read from
The worksheet
Copy constructor
The worksheet
Property for determining type of validation
Enum for available data validation types
Any value
Integer value
Decimal values
List of values
Text length validation
DateTime validation
Time validation
Custom validation
Types of datavalidation
Validation type
Returns a validation type by
The string representation written to the xml
warning style, controls how Excel will handle invalid changes.
warning style will be excluded.
Excel will default this to Stop warning style.
stop warning style, invalid changes will not be accepted
warning will be presented when an attempt to an invalid change is done, but the change will be accepted.
information warning style.
A validation containing a formula
Name of worksheet this datavalidation belongs to
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
The worksheet
Constructor for reading data
The XmlReader to read from
The worksheet
Copy Constructor
The worksheet
Formula - Either a {T} value (except for custom validation) or a spreadsheet formula
Validates the configuration of the validation.
Will be thrown if invalid configuration of the validation. Details will be in the message of the exception.
Represents a data validation with two formulas
An instance implementing the
Constructor
Uid of the data validation, format should be a Guid surrounded by curly braces.
Constructor for reading data
The XmlReader to read from
The worksheet
Copy Constructor
The worksheet
Formula - Either a {T} value or a spreadsheet formula
Validate the validation
Represents a time between 00:00:00 and 23:59:59
Max number of decimals when rounding.
Default constructor
Constructor
An existing time for initialization
If we are unlucky second might be rounded up to 60. This will have the minute to be raised and might affect the hour.
Hour between 0 and 23
Minute between 0 and 59
Second between 0 and 59
Returns the excel decimal representation of a time.
Returns the excel decimal representation of a time as a string.
Converts the object to a string
The string
Thrown if a formula exceeds the maximum number of characters.
Initiaize a new
The exception message
Interface for a data validation formula
An excel formula
Validation formula interface for
Interface for a data validation formula of float value
Interface for a data validation formula of value
Interface for a data validation of list type
A list of value strings.
Interface for a time data validation
Interface for a formula with a value
The value.
Enumeration representing the state of an
Value is set
Formula is set
Base class for a formula
Constructor
id of the data validation containing this formula
State of the validationformula, i.e. tells if value or formula is set
A formula which output must match the current validation type
This value will be stored in the xml. Can be overridden by subclasses
Returns the value as a string. Must be implemented by subclasses
This class represents a validation formula. Its value can be specified as a value of the specified datatype or as a formula.
Constructor
Uid for the data validation
The worksheet namme
Callback function to handle the forumla
Typed value
Provides functionality for adding datavalidation to a range (). Each method will
return a configurable validation.
Adds a to the range.
A that can be configured for any validation
Adds a to the range
A that can be configured for integer data validation
Adds a to the range
A that can be configured for decimal data validation
Adds a to the range
A that can be configured for datetime data validation
Adds a to the range
A that can be configured for datetime data validation
Adds a regarding text length validation to the range.
Adds a to the range.
A that can be configured for time data validation
Adds a to the range.
A that can be configured for custom validation
Removes validation from the cell/range
Delete the validation if it has no more addresses its being applied to. If set to false an will be thrown if all addresses of a datavalidation has been cleared.
Thrown if is false and all addresses of a datavalidation has been cleared.
Used to remove all dataValidations in cell or cellrange
Deletes the dataValidation if it has no addresses after clear
How to color a region map chart serie
Region map chart is colored by values
Region map chart is colored by secondary category names
The color type for a region map charts color variation
The position’s location on the gradient is determined the numerical value in the property.
The position’s location on the gradient is determined by a fixed percent value in the property, represented by the gradient. Ranges from 1 to 100 percent.
The position is the minimum or maximum stop of the gradient.
Side positions for a chart element
The formula is interpreted column-wise
The formula is interpreted row-wise
Geomapping level
Geomapping level is handled automatic
Only regions which correspond to data points in the geographical category of a geospatial series are in view.
The level of view for the series is set to postal code.
The level of view for the series is set to county.
The level of view for the series is set to state or province.
The level of view for series is set to country/region.
The level of view for the series is set to continent.
The level of view for the series is set to the entire world.
The interval closed side.
The IntervalClosed is not specified.
The interval is closed on the left side
The interval is closed on the right side
The number of colors used to create the series gradient color scale in a extended chart.
Uses two colors to create the gradient color scale
Diverging. Uses three colors to create the gradient color scale
Side positions for a chart element
The dimension is a value.
The dimension is an x-coordinate.
The dimension is a y-coordinate.
The dimension is a size.
The dimension is a value determining a color.
The layout type for the parent labels
No parent labels are shown
Parent label layout is a banner above the category
Parent label is laid out within the category
The side position alignment of a chart element
The chart element is positioned at the top of the side.
The chart element is positioned at the center of the side.
The chart element is positioned at the bottom of the side.
The cartographic map projection for a region map chart series
Automatic
A Mercator projection.
a Miller cylindrical projection.
A Robinson projection.
An Albers equal-area conic projection.
The quartile calculation methods
The quartile calculation includes the median when splitting the dataset into quartiles
The quartile calculation excludes the median when splitting the dataset into quartiles
The layout type for region labels of a geospatial series
No region labels appear in a geospatial series
Region labels only appear if they can fit in their respective containing geometries in a geospatial series
All region labels appear
Side positions for a chart element
The title or legend is on the left side.
The title or legend is on the top.
The title or legend is on the right side.
The title or legend is on the bottom.
Side positions for a chart element
The category string dimension data type.
The string dimension associated with a color.
The geographical entity identifier string dimension data type.
This dimension can be used to provide locations to a geospatial series in a Geographic chart.
Refer to the usage of entityId in Geo Cache and Data.
Represents a Box & Whisker Chart
The series for a Box & Whisker chart
A series for an Box & Whisker Chart
The layout type for the parent labels
The quartile calculation methods
The visibility of connector lines between data points
The visibility of markers denoting the mean
The visibility of non-outlier data points
The visibility of outlier data points
Base class for all extention charts
Delete the charts title
Plotarea properties
An array containg all axis of all Charttypes
The titel of the chart
Legend
Border
Access to Fill properties
Effects
3D properties
Access to font properties
Access to text body properties
Chart series
Is not applied to Extension charts
Cannot be set for extension charts. Please use
If the chart has a title or not
If the chart has legend or not
3D settings
This property does not apply to extended charts.
This property will always return eDisplayBlanksAs.Zero.
Setting this property on an extended chart will result in an InvalidOperationException
This property does not apply to extended charts.
Setting this property on an extended chart will result in an InvalidOperationException
This property does not apply to extended charts.
Setting this property on an extended chart will result in an InvalidOperationException
This property does not apply to extended charts.
Setting this property on an extended chart will result in an InvalidOperationException
The X Axis
The Y Axis
An axis for an extended chart
Major tickmarks settings for the axis
Minor tickmarks settings for the axis
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
Labelposition. This property does not apply to extended charts.
If the axis is hidden.
Tick label position. This property does not apply to extended charts.
Display units. Please only use values in or 0 for none.
The title of the chart
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
The data used as source for the chart. Only spreadsheet internal data is supported at this point.
Data formula
The direction of the formula
The dimensions name formula. Return null if the element does not exist
Direction for the name formula
A collection of chart data.
The id of the data
Adds a numeric dimension
The formula or address
The numeric data
Adds a string dimension
The formula or address
The string data
Indexer
The index
Number of items in the collection
Get the enumerator
Get the enumerator
Datalabel on chart level.
The datalabel position
Show values in the datalabels
Show category names in the datalabels
Show series names in the datalabels
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
This property is not used for extended charts. Trying to set this property will result in a NotSupportedException.
The separator between items in the datalabel
A collection of individual data labels
Adds an individual data label for customization.
The zero based index
Returns tje data label at the specific position.
The index of the datalabel. 0-base.
Returns null if the data label does not exist in the collection
Get the enumerator
An individual datalabel item
The index of the datapoint the label is attached to
An individual data point
The index of the datapoint
The data point is a subtotal. Applies for waterfall charts.
A reference to fill properties
A reference to line properties
A reference to line properties
3D properties
A collection of datapoints for a chart
Adds a new datapoint to the collection
The zero based index
The datapoint
Checkes if the index exists in the collection
The index
true if exists
Indexer
The index
Number of items in the collection
Gets the enumerator for the collection
The enumerator
A legend for an Extended chart
The side position alignment of the legend
The position of the Legend.
Setting the Position to TopRight will set the to Right and the to Min
Adds a legend to the chart
Numeric data reference for an extended chart
The type of data.
A pareto line for a histogram chart
Effects
A plotarea for an extended chart
Not applicable on extended charts. Will throw
Will always be thrown
Not applicable on extended charts. Will throw
Will always be thrown
A chart serie
Default constructor
The chart
Namespacemanager
Topnode
The dimensions of the serie
Header address for the serie.
The header text for the serie.
Set this to a valid address or the drawing will be invalid.
Set an address for the horizontal labels
Data label properties
A collection of individual data points
If the serie is hidden
If the chart has datalabel
Number of items. Will always return 0, as no item data is stored.
Trendline do not apply to extended charts.
Data binning properties
The binning by bin size. Setting this property clears the property
The binning by bin count. Setting this property clears the property
The interval closed side.
The custom value for underflow bin is set to automatic.
A custom value for underflow bin.
The custom value for overflow bin is set to automatic.
A custom value for overflow bin.
Datalabel properties
Individually formatted data labels.
Adds data labels to the series.
Show the category name
Show values
Show series name
Removes data labels from the series
String data reference for an extended chart
The type of data
Richtext.Text shorthand
The side position alignment of the title
The position if the title
Individual color settings for a region map charts series colors
The color
The color variation type.
The color variation value.
Color variation for a region map chart series
Number of colors to create the series gradient color scale.
If two colors, the mid color is null.
The minimum color value.
The mid color value. Null if NumberOfcolors is set to TwoColors
The maximum color value.
Represents a Funnel Chart
Represents a Histogram Chart
The series for a histogram chart
A series for an Histogram Chart
The data binning properties
If x-axis is per category
Properties for the pareto line.
Represents a Region Map Chart
The series for a region map chart
A chart series for a region map chart
The provider or source of the geographical data. Default is Bing.
Specifies the country code. Uses the TwoLetterISOLanguageName property of the CultureInfo object.
Specifies the language.
The cartographic map projection for the series
The level of view for the series
Colors for the gradient scale of the region map series.
Layout type for region labels
How to color a region maps chart serie
Represents a Sunburst Chart
Represents a Treemap Chart
The series for a treemap chart
A series for an Treemap Chart
The layout type for the parent labels
Represents an Waterfall Chart
The series for a waterfall chart
A series for an Waterfall Chart
The visibility of connector lines between data points
Area chart type
An area chart
A stacked area chart
A stacked 100 percent area chart
An 3D area chart
A stacked area 3D chart
A stacked 100 percent 3D area chart
Axis orientaion
Max to min
Min to max
Position of the axis.
Left
Bottom
Right
Top
Tickmarks
The tick marks will cross the axis.
The tick marks will be inside the plot area.
There will be no tick marks.
The tick marks will be outside the plot area.
Value axis
Category axis
Date axis
Series axis
Bar chart type
A clustered 3D bar chart
A stacked 3D bar chart
A Stacked 100 percent 3D bar chart
A 3D column chart
A clustered 3D column chart
A stacked 3D column chart
A stacked 100 percent 3D column chart
A clustered bar chart
A stacked bar chart
A stacked 100 percent bar chart
A clustered column chart
A stacked column chart
A stacked column 100 percent chart
A clustered cone bar chart
A stacked cone bar chart
A stacked 100 percent cone bar chart
A cone column chart
A clustered cone column chart
A stacked cone column chart
A stacked 100 percent cone column chart
A clustered cylinder bar chart
A stacked cylinder bar chart
A stacked 100 percent cylinder bar chart
A cylinder column chart
A clustered cylinder column chart
A stacked cylinder column chart
A stacked 100 percent cylinder column chart
A clustered pyramid bar chart
A stacked pyramid bar chart
A stacked 100 percent pyramid bar chart
A stacked pyramid column chart
A clustered pyramid column chart
A stacked pyramid column chart
A stacked 100 percent pyramid column chart
Bubble chart types
A bubble chart
A 3D bubble chart
Build in units for a chart axis
100
1,000
10,000
100,000
1,000,000
10,000,000
10,000,000
1,000,000,000
1,000,000,000,000
Chart type
A treemap chart
A histogram chart
A waterfall chart
A sunburst chart
A box whisker
A Histogram Pareto chart
A funnel chart
A region map chart
The build in style of the chart.
No style
Style 1
Style 2
Style 3
Style 4
Style 5
Style 6
Style 7
Style 8
Style 9
Style 10
Style 11
Style 12
Style 13
Style 14
Style 15
Style 16
Style 17
Style 18
Style 19
Style 20
Style 21
Style 22
Style 23
Style 24
Style 25
Style 26
Style 27
Style 28
Style 29
Style 30
Style 31
Style 32
Style 33
Style 34
Style 35
Style 36
Style 37
Style 38
Style 39
Style 40
Style 41
Style 42
Style 43
Style 44
Style 45
Style 46
Style 47
Style 48
Style 102
Chart type
An 3D area chart
A stacked area 3D chart
A 100% stacked 3D area chart
A clustered 3D bar chart
A stacked 3D bar chart
A 100% stacked 3D bar chart
A 3D column chart
A clustered 3D column chart
A stacked 3D column chart
A 100% stacked 3D column chart
A 3D line chart
A 3D pie chart
A exploded 3D pie chart
An area chart
A stacked area chart
A 100% stacked area chart
A clustered bar chart
A bar of pie chart
A stacked bar chart
A 100% stacked bar chart
A bubble chart
A 3D bubble chart
A clustered column chart
A stacked column chart
A 100% stacked column chart
A clustered cone bar chart
A stacked cone bar chart
A 100% stacked cone bar chart
A cone column chart
A clustered cone column chart
A stacked cone column chart
A 100% stacked cone column chart
A clustered cylinder bar chart
A stacked cylinder bar chart
A 100% stacked cylinder bar chart
A cylinder column chart
A clustered cylinder column chart
A stacked cylinder column chart
A 100% stacked cylinder column chart
A doughnut chart
An exploded doughnut chart
A line chart
A line chart with markers
A stacked line chart with markers
A 100% stacked line chart with markers
A stacked line chart
A 100% stacked line chart
A pie chart
An exploded pie chart
A pie of pie chart
A clustered pyramid bar chart
A stacked pyramid bar chart
A 100% stacked pyramid bar chart
A stacked pyramid column chart
A clustered pyramid column chart
A stacked pyramid column chart
A 100% stacked pyramid column chart
A radar chart
A filled radar chart
A radar chart with markers
Stock chart with a High, Low and Close serie
Stock chart with an Open, High, Low and Close serie
Stock chart with an Volume, High, Low and Close serie
Stock chart with an Volume, Open, High, Low and Close serie
A surface chart
A surface chart, top view
A surface chart, top view and wireframe
A surface chart, wireframe
A XY scatter chart
A scatter line chart with markers
A scatter line chart with no markers
A scatter line chart with markers and smooth lines
A scatter line chart with no markers and smooth lines
A treemap chart
A histogram chart
A waterfall chart
A sunburst chart
A box & whisker chart
A histogram chart with a pareto line
A funnel chart
A region map chart
How the axis are crossed
The value axis will cross the category axis between data markers
The value axis will cross the category axis at the middle of a category.
Where the axis cross.
The category axis crosses at the zero point of the valueaxis or the lowest or higest value if scale is over or below zero.
The axis crosses at the maximum value
Axis crosses at the minimum value
Bar or column
A column
A bar
How to display blanks in a chart
Blank values will be left as a gap
Blank values will be spanned with a line for line charts
Blank values will be treated as zero
Doughnut chart types
A doughnut chart
An exploded doughnut chart
How the series are grouped
Standard grouping
Clustered grouping
Stacked grouping
100% stacked grouping
Position of the labels
Best fit
Left aligned
Right aligned
Center aligned
Top aligned
Bottom aligned
Labels will be displayed inside the data marker
Labels will be displayed inside the end of the data marker
Labels will be displayed outside the end of the data marker
In which way to store the position of a chart element
Store as an offset from labels default position.
Store as an offset from the relevant Edge of the element
Define layout of plot area
Specifies that the plot area size shall determine the
size of the plot area, not including the tick marks and
axis labels.
Specifies that the plot area size shall determine the
size of the plot area, the tick marks, and the axis
labels.
Position of the legend
Positioned over the chart area
Positioned to the left the chart area
Positioned to the right the chart area
Positioned below the chart area
Positioned to the top right of the chart area
Line chart type
A 3D line chart
A line chart
A line chart with markers
A stacked line chart with markers
A 100% stacked line chart with markers
A stacked line chart
A 100% stacked line chart
Markerstyle
The shape of a circle
The shape of a dash
The shape of a diamond
The shape of a dot
No marker
A picture, currently unsupported
The shape of a plus
The shape of a square
The shape of a star
The shape of a triangle
The shape of a X
OfPie chart types
A pie of pie chart
A bar of pie chart
Pie and Doughnut chart type
A pie chart
An exploded pie chart
A 3D pie chart
A exploded 3D pie chart
Bar or pie
Represents a bar of pie chart
Represents a pie of pie chart
Radar chart types
A radar chart
A filled radar chart
A radar chart with markers
Radar chart type
The radar chart will be filled and have lines, but will not have markers.
The radar chart will have lines and markers, but will not be filled.
The radar chart will have lines, but no markers and no filling.
Scatter chart types
A XY scatter chart
A scatter line chart with markers
A scatter line chart with no markers
A scatter line chart with markers and smooth lines
A scatter line chart with no markers and smooth lines
Smooth or lines markers
Line and markers
Smooth lines and markers
Shape for bar charts
A box shape
A cone shape
A cone shape, truncated to max
A cylinder shape
A pyramid shape
A pyramid shape, truncated to max
How to represent data as bubble chart sizes
The area of the bubbles will be proportional to the bubble size.
The radius of the bubbles will be proportional to the bubble size.
The type of stock chart.
Stock chart with a High, Low and Close serie
Stock chart with an Open, High, Low and Close serie
Stock chart with an Volume, High, Low and Close serie
Stock chart with an Volume, Open, High, Low and Close serie
Surface chart type
A surface chart
A surface chart, top view
A surface chart, top view and wireframe
A surface chart, wireframe
Axis label position
The axis labels will be at the high end of the perpendicular axis
The axis labels will be at the low end of the perpendicular axis
The axis labels will be next to the axis.
No axis labels are drawn
The time unit of major and minor datetime axis values
Years
Months
Days
Type of Trendline for a chart
The trendline will be an exponential curve. y = abx
The trendline will be a linear curve. y = mx + b
The trendline will be a logarithmic curve y = a log x + b
The trendline will be the moving average.
The trendline will be a polynomial curve.
The trendline will be a power curve. y = axb
Position of the X-Axis
To the bottom
To the top
Position of the Y-Axis
To the left
To the right
Represents an Area Chart
Access to datalabel properties
If the chart has datalabel
The series for the Area Chart
s
A series for an Area Chart
Default constructor
Chart series
Namespacemanager
Topnode
Is pivotchart
Datalabel
If the chart has datalabel
A collection of the individual datapoints
Represents a Bar Chart
Direction, Bar or columns
The shape of the bar/columns
Access to datalabel properties
If the chart has datalabel
The size of the gap between two adjacent bars/columns
Specifies how much bars and columns shall overlap
Series for a bar chart
A serie for a Bar Chart
s
Default constructor
Chart series
Namespacemanager
Topnode
Is pivotchart
Datalabel
If the chart has datalabel
A collection of the individual datapoints
Represents a Bar Chart
Specifies the scale factor of the bubble chart. Can range from 0 to 300, corresponding to a percentage of the default size,
If negative sized bubbles will be shown on a bubble chart
If the bubblechart is three dimensional
The scale factor for the bubble chart. Can range from 0 to 300, corresponding to a percentage of the default size,
Access to datalabel properties
If the chart has datalabel
The series for a bubble charts
A serie for a bubble chart
Default constructor
The chart
Namespacemanager
Topnode
Is pivotchart
Datalabel
If the chart has datalabel
The dataseries for the Bubble Chart
The size of the bubbles
A collection of the individual datapoints
Represents a collection of bubble chart series
Adds a new serie to a bubble chart
The Y-Axis range
The X-Axis range
The size of the bubbles range. If set to null, a size of 1 is used
The Y-Axis range
The X-Axis range
The size of the bubbles range. If set to null or String.Empty, a size of 1 is used
Base class for Chart object.
The Xml helper for the chart xml
Manage style settings for the chart
If true the charttype will use the secondary axis.
The chart must contain a least one other charttype that uses the primary axis.
Reference to the worksheet
The chart xml document
The type of drawing
Type of chart
The chart element
The titel of the chart
True if the chart has a title
If the chart has a legend
Remove the title from the chart
Chart series
An array containg all axis of all Charttypes
The X Axis
The Y Axis
The build-in chart styles.
Use for the more modern styling.
Plotarea
Legend
Border
Access to Fill properties
Effects
3D properties
Access to font properties
Access to text body properties
If the chart is a pivochart this is the pivotable used as source.
Package internal URI
Returns true if the chart is a 3D chart
The charttype to tests
True if the chart is a 3D chart
Returns true if the chart is a 3D chart
True if the chart is a 3D chart
Returns true if the chart is a line chart
True if the chart is a line chart
Returns true if the chart is a radar chart
True if the chart is a radar chart
Returns true if the chart is a scatter chart
True if the chart is a scatter chart
Returns true if the chart is a bubble chart
True if the chart is a bubble chart
Returns true if the chart is a scatter chart
True if the chart is a scatter chart
Returns true if the chart is a sureface chart
True if the chart is a sureface chart
Returns true if the chart is a sureface chart
True if the chart is a sureface chart
Returns true if the chart has shapes, like bars and columns
True if the chart has shapes
Returns true if the chart is of type stacked percentage
True if the chart is of type stacked percentage
Returns true if the chart is of type stacked
True if the chart is of type stacked
Returns true if the chart is of type clustered
True if the chart is of type clustered
Returns true if the chart is a pie or Doughnut chart
True if the chart is a pie or Doughnut chart
Returns true if the chart is a Doughnut chart
True if the chart is a Doughnut chart
Returns true if the chart is a pie chart
true if the chart is a pie chart
Return true if the chart is a stock chart.
true if the chart is a stock chart.
If the chart has only one serie this varies the colors for each point.
This property does not apply to extention charts.
Formatting for the floor of a 3D chart.
This property is null for non 3D charts
Formatting for the sidewall of a 3D chart.
This property is null for non 3D charts
Formatting for the backwall of a 3D chart.
This property is null for non 3D charts
Border rounded corners
Show data in hidden rows and columns
Specifies the possible ways to display blanks
Specifies data labels over the maximum of the chart shall be shown
3D-settings
An axis for a chart
Type of axis
Get or Sets the major tick marks for the axis.
Get or Sets the minor tick marks for the axis.
The type of axis
Where the axis is located
Where the axis crosses
How the axis are crossed
The value where the axis cross.
Null is automatic
The Numberformat used
The Numberformats are linked to the source data.
The Position of the labels
Access to fill properties
Access to border properties
Effects
3D properties
Access to font properties
Access to text body properties
String settings like fills, text outlines and effects
If the axis is deleted
Position of the Lables
The scaling value of the display units for the value axis
Chart axis title
Gives access to the charts title properties.
Minimum value for the axis.
Null is automatic
Max value for the axis.
Null is automatic
Major unit for the axis.
Null is automatic
Major time unit for the axis.
Null is automatic
Minor unit for the axis.
Null is automatic
Minor time unit for the axis.
Null is automatic
The base for a logaritmic scale
Null for a normal scale
Axis orientation
Major gridlines for the axis
Effects for major gridlines for the axis
Minor gridlines for the axis
Effects for minor gridlines for the axis
True if the axis has major Gridlines
True if the axis has minor Gridlines
Removes Major and Minor gridlines from the Axis
Removes gridlines from the Axis
Indicates if the Major gridlines should be removed
Indicates if the Minor gridlines should be removed
Adds gridlines and styles them according to the style selected in the StyleManager
Indicates if the Major gridlines should be added
Indicates if the Minor gridlines should be added
Adds the axis title and styles it according to the style selected in the StyleManager
Removes the axis title
An axis for a standard chart.
Get or Sets the major tick marks for the axis.
Get or Sets the minor tick marks for the axis.
Where the axis is located
Chart axis title
Minimum value for the axis.
Null is automatic
Max value for the axis.
Null is automatic
The Position of the labels
Where the axis crosses
How the axis are crossed
The value where the axis cross.
Null is automatic
If the axis is deleted
Position of the Lables
The scaling value of the display units for the value axis
Major unit for the axis.
Null is automatic
Major time unit for the axis.
Null is automatic
Minor unit for the axis.
Null is automatic
Minor time unit for the axis.
Null is automatic
The base for a logaritmic scale
Null for a normal scale
Axis orientation
Adds the axis title and styles it according to the style selected in the StyleManager
The cell linked to the title.
Enumerates charttypes
Add a new charttype to the chart
The type of the new chart
Adds a new line chart to the chart
The type of the new chart
The chart
Adds a new bar chart to the chart
The type of the new chart
The chart
Adds a new area chart to the chart
The type of the new chart
The chart
Adds a new pie chart to the chart
The type of the new chart
The chart
Adds a new column of pie- or bar of pie chart to the chart
The type of the new chart
The chart
Adds a new doughnut chart to the chart
The type of the new chart
The chart
Adds a new radar chart to the chart
The type of the new chart
The chart
Adds a new scatter chart to the chart
The type of the new chart
The chart
Number of items in the collection
Returns a chart at the specific position.
The position of the chart. 0-base
Data labels on the chart level.
This class is inherited by ExcelChartSerieDataLabel
The position of the data labels
Show the values
Show category names
Show series names
Show percent values
Show the leader lines
Show Bubble Size
Show the Lengend Key
Separator string
The Numberformat string.
The Numberformats are linked to the source data.
Access fill properties
Access border properties
Effects
3D properties
Access font properties
Text settings like fills, text outlines and effects
Access to text body properties
Translates the label position
The position enum
The string
Translates the enum position
The string value to translate
The enum value
A collection of individually formatted datalabels
Adds a new chart label to the collection
The index
Indexer for the collection
The index
Number of items in the collection
Gets the enumerator for the collection
The enumerator
Represents an individual datalabel
Define position for manual elements
The index of an individual datalabel
Settings for a charts data lables
Position of the labels
Note: Only Center, InEnd and InBase are allowed for dataLabels on stacked columns
Show the values
Show category names
Show series names
Show percent values
Show the leader lines
Show Bubble Size
Show the Lengend Key
Separator string
Represents an individual datapoint in a chart
The index of the datapoint
The sizes of the bubbles on the bubble chart
Invert if negative. Default true.
A reference to marker properties
A reference to fill properties
A reference to line properties
A reference to line properties
3D properties
Returns true if the datapoint has a marker
Dispose the object
A collection of datapoints
Checkes if the index exists in the collection
The index
true if exists
Adds a new datapoint to the collection
The index
The datapoint
Indexer
The index
Number of items in the collection
Gets the enumerator for the collection
The enumerator
Data table on chart level.
The horizontal borders will be shown in the data table
The vertical borders will be shown in the data table
The outline will be shown on the data table
The legend keys will be shown in the data table
Access fill properties
Access border properties
Access font properties
Access to text body properties
String settings like fills, text outlines and effects
Effects
3D properties
The title of a chart
The directions for the error bars. For scatter-, bubble- and area charts this property can't be changed. Please use the ErrorBars property for Y direction and ErrorBarsX for the X direction.
The ways to draw an error bar
The ways to determine the length of the error bars
If true, no end cap is drawn on the error bars
The value which used to determine the length of the error bars when ValueType is FixedValue
Numeric Source for plus errorbars when ValueType is set to Custom
Numeric Source for minus errorbars when ValueType is set to Custom
Fill style
Border style
Effects
3D properties
Remove the error bars
A chart legend
A list of individual settings for legend entries.
The position of the Legend
If the legend overlays other objects
The Fill style
The Border style
The Font properties
Access to text body properties
Effects on the legend shape.
Note that the Text effects are set using the property.
Text settings like fills, text outlines and effects
3D properties
Remove the legend
Adds a legend to the chart
An individual serie item within the chart legend
The index of the item
If the items has been deleted or is visible.
The Font properties
Access to text body properties
Access to border properties
Access to effects styling properties
Access to fill styling properties.
Access to 3D properties.
Represents a up-down bar, dropline or hi-low line in a chart
Access to fill properties
Access to border properties
Effects
3D properties
Removes the item
Represents a marker on a chart serie
The marker style
The size of the marker.
Ranges from 2 to 72.
A reference to the fill properties
A reference to border properties
Effects
3D properties
A numeric source for a chart.
This can be an address, function or litterals.
Litternals are formatted as a comma separated list surrounded by curly brackets, for example {1.0,2.0,3}. Please use a dot(.) as decimal sign.
The format code for the numeric source
A charts plot area
If a chart contains multiple chart types (e.g lineChart,BarChart), they end up here.
Creates a data table in the plotarea
The datatable can also be accessed via the DataTable propery
Remove the data table if it's created in the plotarea
The data table object.
Use the CreateDataTable method to create a datatable if it does not exist.
Access to fill properties
Access to border properties
Effects
3D properties
Base class for chart series for standard charts
The header for the chart serie
Literals for the Y serie, if the literal values are numeric
Literals for the X serie, if the literal values are numeric
Literals for the X serie, if the literal values are strings
The header address for the serie.
The address for the vertical series.
The address for the horizontal series.
Access to fill properties
Access to border properties
Effects
3D properties
Number of items in the serie.
A collection of trend lines for the chart serie.
Datalabel properties
Individually formatted datalabels.
Collection class for chart series
Returns the serie at the specified position.
The position of the series.
Number of items in the collection
Delete the chart at the specific position
Zero based
A reference to the chart object
Adds a new serie to the chart. Do not apply to pivotcharts.
The value serie range
The serie
Adds a new serie to the chart. Do not apply to pivotcharts.
The value serie range
The serie
Adds a new serie to the chart. Do not apply to pivotcharts.
The Y-Axis range
The X-Axis range
The serie
Adds a new serie to the chart.Do not apply to pivotcharts.
The Y-Axis range
The X-Axis range
The serie
Adds a new serie to the chart
The Y-Axis range
The X-Axis range
Bubble chart size
Gets the enumerator for the collection
The enumerator
A base class used for chart series that support ErrorBars
Default constructor
Chart series
Namespacemanager
Topnode
Is pivotchart
A collection of error bars
Adds a errorbars to the chart serie
Returns true if the serie has Error Bars
True if the serie has Error Bars
A base class used for chart series that support ErrorBars
Default constructor
Chart series
Namespacemanager
Topnode
Is pivotchart
Horizontal error bars
Adds error bars to the chart serie for both vertical and horizontal directions.
The type of error bars
The type of value the error bars will show
Adds error bars to the chart serie for vertical or horizontal directions.
The type of error bars
The type of value the error bars will show
Direction for the error bars. A value of null will add both horizontal and vertical error bars.
Base class for Chart object.
Get the name of the chart node
The name
Add a secondary axis
Title of the chart
True if the chart has a title
If the chart has a legend
Remove the title from the chart
The build-in chart styles.
Border rounded corners
Show data in hidden rows and columns
Specifies the possible ways to display blanks
Specifies data labels over the maximum of the chart shall be shown
Remove all axis that are not used any more
Plotarea
Legend
Border
Access to Fill properties
Effects
3D properties
Access to font properties
Access to text body properties
3D-settings
Specifies the kind of grouping for a column, line, or area chart
If the chart has only one serie this varies the colors for each point.
Axis array
The X Axis
The Y Axis
A chart serie
Default constructor
The chart
Namespacemanager
Topnode
Is pivotchart
Header for the serie.
Header address for the serie.
Set this to a valid address or the drawing will be invalid.
Set an address for the horisontal labels
Access to the trendline collection
Number of items in the serie
Creates a num cach for a chart serie.
Please note that a serie can only have one column to have a cache.
Chart surface settings
Show the values
Access fill properties
Access border properties
Effects
3D properties
The title of a chart
The text
A reference to the border properties
A reference to the fill properties
A reference to the font properties
Access to text body properties
Text settings like fills, text outlines and effects
Effects
3D properties
Richtext. If the title is linked to a cell via , this property returns null
Show without overlaping the _chart.
The centering of the text. Centers the text to the smallest possible text container.
How the text is anchored
Vertical text
Rotation in degrees (0-360)
A chart title for a standard chart.
The _chart title text
A reference to a cell used as the title text
A trendline object
Type of Trendline
Name in the legend
Order for polynominal trendlines
Period for monthly average trendlines
Forcast forward periods
Forcast backwards periods
The point where the trendline crosses the vertical axis
If to display the R-squared value for a trendline
If to display the trendline equation on the chart
Access to fill properties
Access to border properties
Effects
3D properties
Trendline labels
Return true if the trendline has labels.
A collection of trendlines.
Add a new trendline
The trendline
Number of items in the collection.
Returns a chart trendline at the specific position.
The index in the collection. 0-base
Access to trendline label properties
Access to fill properties
Access to border properties
Access to font properties
Access to text body properties
Effects
3D properties
Richtext
Numberformat
If the numberformat is linked to the source data
Provides access to doughnut chart specific properties
Angle of the first slize
Size of the doubnut hole
Text settings for drawing objects.
The Fill style
The text outline style.
Text effects
A collection of chart serie for a Histogram chart.
Adds a pareto line to the serie.
Removes the pareto line for the serie
Layout settings
Manual layout settings for precise control of element position
Base class for standard charts with line properties.
If the series has markers
If the series has smooth lines
Access to datalabel properties
If the chart has datalabel
The gap width between the up and down bars
Format the up bars on the chart
Format the down bars on the chart
Format the high-low lines for the series.
Format the drop lines for the series.
Adds up and/or down bars to the chart.
Adds up bars if up bars does not exist.
Adds down bars if down bars does not exist.
Adds droplines to the chart.
Adds High-Low lines to the chart.
The series for the chart
Provides access to line chart specific properties
A serie for a line chart
Default constructor
The chart
Namespacemanager
Topnode
Is pivotchart
Datalabels
If the chart has datalabel
A reference to marker properties
If the serie has markers
True if serie has markers
Smooth lines
A collection of the individual datapoints
Line color.
The color of the line.
Gets or sets the size of the marker.
value between 2 and 72.
The size of the marker.
Gets or sets the width of the line in pt.
The width of the line.
Marker Line color.
(not to be confused with LineColor)
The color of the Marker line.
Manual layout for specifing positions of elements manually.
For easiest use it is recommended to not change the modes of width or height.
Left and Top are used to determine x and y position
Width and Height to define the width and height of the element.
By default all elements originate from their default
Use eLayoutMode.Edge to set origin to the edge of the chart for the relevant element.
Define mode for Left (x) attribute
Edge for origin point left chart edge, Factor for origin point DataLabel position
Define mode for Top (y) attribute
Edge for origin point top chart edge, Factor for origin point DataLabel position
Define mode for Width (Right) attribute
Using edge is not recommended.
Edge for Width to be considered the Right of the chart element.
Note: In this case Width will be used for determining Both the element width and its right.
Define mode for Height (Bottom) attribute
Using edge is not recommended.
Edge for Height to be considered the bottom of the chart element.
Note: In this case Height will be used for determining Both the element width and its bottom.
Define mode for Width (Right) attribute
Using edge is not recommended.
Edge for Width to be considered the Right of the chart element.
Note: In this case Width will be used for determining Both the element width and its right.
Legacy variable. if WidthMode property is set this will be overridden.
Define mode for Height (Bottom) attribute
Using edge is not recommended.
Edge for Height to be considered the bottom of the chart element.
Legacy variable. if HeightMode property is set this will be overridden.
Left offset between 100 to -100% of the chart width. In Excel exceeding these values counts as setting the property to 0.
In Edge mode negative values are not allowed.
Top offset between 100 to -100% of the chart height. In Excel exceeding these values counts as setting the property to 0.
In Edge mode negative values are not allowed.
Width offset between 100 to -100% of the chart width. In Excel exceeding these values counts as setting the property to 0.
Height offset between 100 to -100% of the chart height. In Excel exceeding these values counts as setting the property to 0.
Right offset between 100 to -100% of the chart width. In Excel exceeding these values counts as setting the property to 0.
Legacy variable. if Height property is set this will be overridden.
Bottom offset between 100 to -100% of the chart width. In Excel exceeding these values counts as setting the property to 0.
Legacy variable. if Height property is set this will be overridden.
Manual layout elements
Provides access to OfPie-Chart specific properties
Type, pie or bar
The size of the gap between two adjacent bars/columns
Provides access to pie chart specific properties
Access to datalabel properties
If the chart has datalabel
A collection of series for a Pie Chart
A serie for a pie chart
Default constructor
The chart
Namespacemanager
Topnode
Is pivotchart
Explosion for Piecharts
DataLabels
If the chart has datalabel
A collection of the individual datapoints
Provides access to line chart specific properties
The type of radarchart
Access to datalabel properties
If the chart has datalabel
A collection of series for a Radar Chart
A serie for a scatter chart
Default constructor
The chart
Namespacemanager
Topnode
Is pivotchart
Datalabel
If the chart has datalabel
A reference to marker properties
If the serie has markers
True if serie has markers
A collection of the individual datapoints
The size of a markers
Provides access to scatter chart specific properties
If the scatter has LineMarkers or SmoothMarkers
If the series has markers
Access to datalabel properties
If the chart has datalabel
A collection of series for a Scatter Chart
A serie for a scatter chart
Default constructor
The chart
Namespacemanager
Topnode
Is pivotchart
Data label properties
If the chart has datalabel
Smooth for scattercharts
A reference to marker properties
If the serie has markers
True if serie has markers
A collection of the individual datapoints
Line color.
The color of the line.
Gets or sets the size of the marker.
value between 2 and 72.
The size of the marker.
Marker color.
The color of the Marker.
Gets or sets the width of the line in pt.
The width of the line.
Marker Line color.
(not to be confused with LineColor)
The color of the Marker line.
Provides access to stock chart specific properties
A collection of series for a Stock Chart
A serie for a scatter chart
Default constructor
The chart
Namespacemanager
Topnode
Is pivotchart
Data label properties
If the chart has datalabel
Smooth for scattercharts
A reference to marker properties
If the serie has markers
True if serie has markers
A collection of the individual datapoints
Line color.
The color of the line.
Gets or sets the size of the marker.
value between 2 and 72.
The size of the marker.
Marker color.
The color of the Marker.
Gets or sets the width of the line in pt.
The width of the line.
Marker Line color.
(not to be confused with LineColor)
The color of the Marker line.
A Surface chart
The surface chart is drawn as a wireframe
A collection of series for a Surface Chart
A serie for a surface chart
Default constructor
The chart
Namespacemanager
Topnode
Is pivotchart
Method for how colors are picked from the Colors collection
The color picked from Colors is the index modulus the total set of colors in the list.
The color picked from Colors is the first color with a brightness that varies from darker to lighter.
The color picked from Colors is the index modulus the total set of colors in the list. The brightness varies from lighter to darker
The color picked from Colors is the first color with a brightness that varies from lighter to darker. The brightness varies from darker to lighter.
The color picked from Colors is the index modulus the total set of colors in the list. The brightness varies from darkerlighter.
Chart color schemes mapping to the default colors in Excel
Colorful Palette 1
Colorful Palette 2
Colorful Palette 3
Colorful Palette 4
Monochromatic Palette 1
Monochromatic Palette 2
Monochromatic Palette 3
Monochromatic Palette 4
Monochromatic Palette 5
Monochromatic Palette 6
Monochromatic Palette 7
Monochromatic Palette 8
Monochromatic Palette 9
Monochromatic Palette 10
Monochromatic Palette 11
Monochromatic Palette 12
Monochromatic Palette 13
Maps to Excel's built-in chart styles, primary for charts with one data serie.
Note that Excel changes chart type depending on many parameters, like number of series, axis type and more, so it will not always match the number in Excel.
To be certain of getting the correct style use the chart style number of the style you want to apply
For charts with more than one series use
By default the styles are loaded into the StyleLibrary.You can also load your own with your own id's.
Styles are fetched from the StyleLibrary by the id provided in this enum.
3D Area Chart style 1
3D Area Chart style 2
3D Area Chart style 3
3D Area Chart style 4
3D Area Chart style 5
3D Area Chart style 6
3D Area Chart style 7
3D Area Chart style 8
3D Area Chart style 9
3D Area Chart style 10
Area Chart style 1
Area Chart style 2
Area Chart style 3
Area Chart style 4
Area Chart style 5
Area Chart style 6
Area Chart style 7
Area Chart style 8
Area Chart style 9
Area Chart style 10
Area Chart style 11
Bar 3d Chart Style 1
Bar 3d Chart Style 2
Bar 3d Chart Style 3
Bar 3d Chart Style 4
Bar 3d Chart Style 5
Bar 3d Chart Style 6
Bar 3d Chart Style 7
Bar 3d Chart Style 8
Bar 3d Chart Style 9
Bar 3d Chart Style 10
Bar 3d Chart Style 11
Bar 3d Chart Style 12
Bar Chart style 1
Bar Chart style 2
Bar Chart style 3
Bar Chart style 4
Bar Chart style 5
Bar Chart style 6
Bar Chart style 7
Bar Chart style 8
Bar Chart style 9
Bar Chart style 10
Bar Chart style 11
Bar Chart style 12
Bar Chart style 13
Bubble Chart Style 1
Bubble Chart Style 2
Bubble 3d Chart Style 1
Bubble 3d Chart Style 2
Bubble 3d Chart Style 3
Bubble 3d Chart Style 4
Bubble 3d Chart Style 5
Bubble 3d Chart Style 6
Bubble 3d Chart Style 7
Bubble 3d Chart Style 8
Bubble 3d Chart Style 8
Bubble Chart Style 3
Bubble Chart Style 4
Bubble Chart Style 5
Bubble Chart Style 6
Bubble Chart Style 7
Bubble Chart Style 8
Bubble Chart Style 9
Bubble Chart Style 10
Bubble Chart Style 11
Column 3d Chart Style 1
Column 3d Chart Style 2
Column 3d Chart Style 3
Column 3d Chart Style 4
Column 3d Chart Style 5
Column 3d Chart Style 6
Column 3d Chart Style 7
Column 3d Chart Style 8
Column 3d Chart Style 9
Column 3d Chart Style 10
Column 3d Chart Style 11
Column 3d Chart Style 12
Column Chart style 1
Column Chart style 2
Column Chart style 3
Column Chart style 4
Column Chart style 5
Column Chart style 6
Column Chart style 7
Column Chart style 8
Column Chart style 9
Column Chart style 10
Column Chart style 11
Column Chart style 12
Column Chart style 13
Column Chart style 14
Column Chart style 15
Column Chart style 16
Custom Combined Chart Style 1
Custom Combined Chart Style 2
Custom Combined Chart Style 3
Custom Combined Chart Style 4
Custom Combined Chart Style 5
Custom Combined Chart Style 6
Custom Combined Chart Style 7
Custom Combined Chart Style 8
Doughnut Chart Style 1
Doughnut Chart Style 2
Doughnut Chart Style 3
Doughnut Chart Style 4
Doughnut Chart Style 5
Doughnut Chart Style 6
Doughnut Chart Style 7
Doughnut Chart Style 8
Doughnut Chart Style 9
Doughnut Chart Style 10
Line 3d Chart style 1
Line 3d Chart style 2
Line 3d Chart style 3
Line 3d Chart style 4
Line Chart style 1
Line Chart style 2
Line Chart style 3
Line Chart style 4
Line Chart style 5
Line Chart style 6
Line Chart style 7
Line Chart style 8
Line Chart style 9
Line Chart style 10
Line Chart style 11
Line Chart style 12
Line Chart style 13
Line Chart style 14
Line Chart style 15
Pie- or Bar-of pie Chart style 1
Pie- or Bar-of pie Chart style 2
Pie- or Bar-of pie Chart style 3
Pie- or Bar-of pie Chart style 4
Pie- or Bar-of pie Chart style 5
Pie- or Bar-of pie Chart style 6
Pie- or Bar-of pie Chart style 7
Pie- or Bar-of pie Chart style 8
Pie- or Bar-of pie Chart style 9
Pie- or Bar-of pie Chart style 10
Pie- or Bar-of pie Chart style 11
Pie- or Bar-of pie Chart style 12
Pie 3d Chart Style 1
Pie 3d Chart Style 2
Pie 3d Chart Style 3
Pie 3d Chart Style 4
Pie 3d Chart Style 5
Pie 3d Chart Style 6
Pie 3d Chart Style 7
Pie 3d Chart Style 8
Pie 3d Chart Style 9
Pie 3d Chart Style 10
Pie Chart Style 1
Pie Chart Style 2
Pie Chart Style 3
Pie Chart Style 4
Pie Chart Style 5
Pie Chart Style 6
Pie Chart Style 7
Pie Chart Style 8
Pie Chart Style 9
Pie Chart Style 10
Pie Chart style 11
Pie Chart style 12
Radar Chart style 1
Radar Chart style 2
Radar Chart style 3
Radar Chart style 4
Radar Chart style 5
Radar Chart style 6
Radar Chart style 7
Radar Chart style 8
Scatter Chart style 1
Scatter Chart style 2
Scatter Chart style 3
Scatter Chart style 4
Scatter Chart style 5
Scatter Chart style 6
Scatter Chart style 7
Scatter Chart style 8
Scatter Chart style 9
Scatter Chart style 10
Scatter Chart style 11
Scatter Chart style 12
Stacked Area 3d Chart Style 1
Stacked Area 3d Chart Style 2
Stacked Area 3d Chart Style 3
Stacked Area 3d Chart Style 4
Stacked Area 3d Chart Style 5
Stacked Area 3d Chart Style 6
Stacked Area 3d Chart Style 7
Stacked Area 3d Chart Style 8
Stacked Area 3d Chart Style 8
Stacked Area 3d Chart Style 10
Stacked Area Chart Style 1
Stacked Area Chart Style 2
Stacked Area Chart Style 3
Stacked Area Chart Style 4
Stacked Area Chart Style 5
Stacked Area Chart Style 6
Stacked Area Chart Style 7
Stacked Area Chart Style 8
Stacked Area Chart Style 9
Stacked Area Chart Style 10
Stacked Area Chart Style 11
Stacked Column Stacked 3d Chart Style 1
Stacked Column 3d Chart Style 2
Stacked Column 3d Chart Style 3
Stacked Column 3d Chart Style 4
Stacked Column 3d Chart Style 5
Stacked Column 3d Chart Style 6
Stacked Column 3d Chart Style 7
Stacked Column 3d Chart Style 8
Stacked Bar Chart Style 1
Stacked Bar Chart Style 2
Stacked Bar Chart Style 3
Stacked Bar Chart Style 4
Stacked Bar Chart Style 5
Stacked Bar Chart Style 6
Stacked Bar Chart Style 7
Stacked Bar Chart Style 8
Stacked Bar Chart Style 9
Stacked Bar Chart Style 10
Stacked Bar Chart Style 11
Stacked Column 3d Chart Style 1
Stacked Column 3d Chart Style 2
Stacked Column 3d Chart Style 3
Stacked Column 3d Chart Style 4
Stacked Column 3d Chart Style 5
Stacked Column 3d Chart Style 6
Stacked Column 3d Chart Style 7
Stacked Column 3d Chart Style 8
Stacked Bar Chart style 1
Stacked Bar Chart style 2
Stacked Bar Chart Style 3
Stacked Bar Chart Style 4
Stacked Bar Chart Style 5
Stacked Bar Chart Style 6
Stacked Bar Chart Style 7
Stacked Bar Chart Style 8
Stacked Bar Chart Style 9
Stacked Bar Chart Style 10
Stacked Bar Chart Style 11
Stock Chart Style 1
Stock Chart Style 2
Stock Chart Style 3
Stock Chart Style 4
Stock Chart Style 5
Stock Chart Style 6
Stock Chart Style 7
Stock Chart Style 8
Stock Chart Style 9
Stock Chart Style 10
Stock Chart Style 11
Sunburst Chart Style 1
Sunburst Chart Style 2
Sunburst Chart Style 3
Sunburst Chart Style 4
Sunburst Chart Style 5
Sunburst Chart Style 6
Sunburst Chart Style 7
Sunburst Chart Style 8
Treemap Chart Style 1
Treemap Chart Style 2
Treemap Chart Style 3
Treemap Chart Style 4
Treemap Chart Style 5
Treemap Chart Style 6
Treemap Chart Style 7
Treemap Chart Style 8
Treemap Chart Style 9
Box & Whisker Chart Style 1
Box & Whisker Chart Style 2
Box & Whisker Chart Style 3
Box & Whisker Chart Style 4
Box & Whisker Chart Style 5
Box & Whisker Chart Style 6
Histogram Chart Style 1
Histogram Chart Style 2
Histogram Chart Style 3
Histogram Chart Style 4
Histogram Chart Style 5
Histogram Chart Style 6
Waterfall Chart Style 1
Waterfall Chart Style 2
Waterfall Chart Style 3
Waterfall Chart Style 4
Waterfall Chart Style 5
Waterfall Chart Style 6
Waterfall Chart Style 7
Waterfall Chart Style 8
Funnel Chart Style 1
Funnel Chart Style 2
Funnel Chart Style 3
Funnel Chart Style 4
Funnel Chart Style 5
Funnel Chart Style 6
Funnel Chart Style 7
Funnel Chart Style 8
Funnel Chart Style 9
Regionmap Chart Style 1
Regionmap Chart Style 2
Regionmap Chart Style 3
Regionmap Chart Style 4
Maps to Excel's built-in chart styles, for charts with more that one data serie.
Note that Excel changes chart type depending on many parameters, like number of series, axis type and more, so it will not always match the number in Excel.
To be certain of getting the correct style use the chart style number of the style you want to apply
For charts with only one data serie use
Styles are fetched from the StyleLibrary by the id provided in this enum.
3D Area Chart style 1
3D Area Chart style 2
3D Area Chart style 3
3D Area Chart style 4
3D Area Chart style 5
3D Area Chart style 6
3D Area Chart style 7
3D Area Chart style 8
3D Area Chart style 9
Area Chart style 1
Area Chart style 2
Area Chart style 3
Area Chart style 4
Area Chart style 5
Area Chart style 6
Area Chart style 7
Area Chart style 8
Area Chart style 9
Area Chart style 10
Bar 3d Chart Style 1
Bar 3d Chart Style 2
Bar 3d Chart Style 3
Bar 3d Chart Style 4
Bar 3d Chart Style 5
Bar 3d Chart Style 6
Bar 3d Chart Style 7
Bar 3d Chart Style 8
Bar 3d Chart Style 9
Bar 3d Chart Style 10
Bar 3d Chart Style 11
Bar Chart style 1
Bar Chart style 2
Bar Chart style 3
Bar Chart style 4
Bar Chart style 5
Bar Chart style 6
Bar Chart style 7
Bar Chart style 8
Bar Chart style 9
Bar Chart style 10
Bar Chart style 11
Bar Chart style 12
Bubble 3d Chart Style 1
Bubble 3d Chart Style 2
Bubble 3d Chart Style 3
Bubble 3d Chart Style 4
Bubble 3d Chart Style 5
Bubble 3d Chart Style 6
Bubble 3d Chart Style 7
Bubble 3d Chart Style 8
Bubble Chart Style 1
Bubble Chart Style 2
Bubble Chart Style 3
Bubble Chart Style 4
Bubble Chart Style 5
Bubble Chart Style 6
Bubble Chart Style 7
Bubble Chart Style 8
Bubble Chart Style 9
Bubble Chart Style 10
Column Chart style 1
Column Chart style 2
Column Chart style 3
Column Chart style 4
Column Chart style 5
Column Chart style 6
Column Chart style 7
Column Chart style 8
Column Chart style 9
Column Chart style 10
Column Chart style 11
Column Chart style 12
Column Chart style 13
Column Chart style 14
Column 3d Chart Style 1
Column 3d Chart Style 2
Column 3d Chart Style 3
Column 3d Chart Style 4
Column 3d Chart Style 5
Column 3d Chart Style 6
Column 3d Chart Style 7
Column 3d Chart Style 8
Column 3d Chart Style 9
Column 3d Chart Style 10
Column 3d Chart Style 11
Custom Combined Chart Style 1
Custom Combined Chart Style 2
Custom Combined Chart Style 3
Custom Combined Chart Style 4
Custom Combined Chart Style 5
Custom Combined Chart Style 6
Custom Combined Chart Style 7
Custom Combined Chart Style 8
Doughnut Chart Style 1
Doughnut Chart Style 2
Doughnut Chart Style 3
Doughnut Chart Style 4
Doughnut Chart Style 5
Doughnut Chart Style 6
Doughnut Chart Style 7
Doughnut Chart Style 8
Doughnut Chart Style 9
Line 3d Chart style 1
Line 3d Chart style 2
Line 3d Chart style 3
Line 3d Chart style 4
Line Chart style 1
Line Chart style 2
Line Chart style 3
Line Chart style 4
Line Chart style 5
Line Chart style 6
Line Chart style 7
Line Chart style 8
Line Chart style 9
Line Chart style 10
Line Chart style 11
Line Chart style 12
Line Chart style 13
Pie- or Bar-of pie Chart style 1
Pie- or Bar-of pie Chart style 2
Pie- or Bar-of pie Chart style 3
Pie- or Bar-of pie Chart style 4
Pie- or Bar-of pie Chart style 5
Pie- or Bar-of pie Chart style 6
Pie- or Bar-of pie Chart style 7
Pie- or Bar-of pie Chart style 8
Pie- or Bar-of pie Chart style 9
Pie- or Bar-of pie Chart style 10
Pie- or Bar-of pie Chart style 11
Pie- or Bar-of pie Chart style 12
Pie Chart Style 1
Pie Chart Style 2
Pie Chart Style 3
Pie Chart Style 4
Pie Chart Style 5
Pie Chart Style 6
Pie Chart Style 7
Pie Chart Style 8
Pie Chart Style 9
Pie Chart Style 10
Pie Chart style 11
Pie Chart style 12
Pie 3d Chart Style 1
Pie 3d Chart Style 2
Pie 3d Chart Style 3
Pie 3d Chart Style 4
Pie 3d Chart Style 5
Pie 3d Chart Style 6
Pie 3d Chart Style 7
Pie 3d Chart Style 8
Pie 3d Chart Style 9
Pie 3d Chart Style 10
Radar Chart style 1
Radar Chart style 2
Radar Chart style 3
Radar Chart style 4
Radar Chart style 5
Radar Chart style 6
Radar Chart style 7
Radar Chart style 8
Scatter Chart style 1
Scatter Chart style 2
Scatter Chart style 3
Scatter Chart style 4
Scatter Chart style 5
Scatter Chart style 6
Scatter Chart style 7
Scatter Chart style 8
Scatter Chart style 9
Scatter Chart style 10
Scatter Chart style 11
Stacked Area 3d Chart Style 1
Stacked Area 3d Chart Style 2
Stacked Area 3d Chart Style 3
Stacked Area 3d Chart Style 4
Stacked Area 3d Chart Style 5
Stacked Area 3d Chart Style 6
Stacked Area 3d Chart Style 7
Stacked Area 3d Chart Style 8
Stacked Area 3d Chart Style 9
Stacked Area Chart Style 1
Stacked Area Chart Style 2
Stacked Area Chart Style 3
Stacked Area Chart Style 4
Stacked Area Chart Style 5
Stacked Area Chart Style 6
Stacked Area Chart Style 7
Stacked Area Chart Style 8
Stacked Area Chart Style 9
Stacked Area Chart Style 10
Stacked Column Stacked 3d Chart Style 1
Stacked Column 3d Chart Style 2
Stacked Column 3d Chart Style 3
Stacked Column 3d Chart Style 4
Stacked Column 3d Chart Style 5
Stacked Column 3d Chart Style 6
Stacked Column 3d Chart Style 7
Stacked Column 3d Chart Style 8
Stacked Bar Chart Style 1
Stacked Bar Chart Style 2
Stacked Bar Chart Style 3
Stacked Bar Chart Style 4
Stacked Bar Chart Style 5
Stacked Bar Chart Style 6
Stacked Bar Chart Style 7
Stacked Bar Chart Style 8
Stacked Bar Chart Style 9
Stacked Bar Chart Style 10
Stacked Bar Chart Style 11
Stacked Column 3d Chart Style 1
Stacked Column 3d Chart Style 2
Stacked Column 3d Chart Style 3
Stacked Column 3d Chart Style 4
Stacked Column 3d Chart Style 5
Stacked Column 3d Chart Style 6
Stacked Column 3d Chart Style 7
Stacked Column 3d Chart Style 8
Stacked Bar Chart style 1
Stacked Bar Chart style 2
Stacked Bar Chart Style 3
Stacked Bar Chart Style 4
Stacked Bar Chart Style 5
Stacked Bar Chart Style 6
Stacked Bar Chart Style 7
Stacked Bar Chart Style 8
Stacked Bar Chart Style 9
Stacked Bar Chart Style 10
Stacked Bar Chart Style 11
Sunburst Chart Style 1
Sunburst Chart Style 2
Sunburst Chart Style 3
Sunburst Chart Style 4
Sunburst Chart Style 5
Sunburst Chart Style 6
Sunburst Chart Style 7
Sunburst Chart Style 8
Treemap Chart Style 1
Treemap Chart Style 2
Treemap Chart Style 3
Treemap Chart Style 4
Treemap Chart Style 5
Treemap Chart Style 6
Treemap Chart Style 7
Treemap Chart Style 8
Treemap Chart Style 9
Box & Whisker Chart Style 1
Box & Whisker Chart Style 2
Box & Whisker Chart Style 3
Box & Whisker Chart Style 4
Box & Whisker Chart Style 5
Box & Whisker Chart Style 6
Histogram Chart Style 1
Histogram Chart Style 2
Histogram Chart Style 3
Histogram Chart Style 4
Histogram Chart Style 5
Histogram Chart Style 6
Waterfall Chart Style 1
Waterfall Chart Style 2
Waterfall Chart Style 3
Waterfall Chart Style 4
Waterfall Chart Style 5
Waterfall Chart Style 6
Waterfall Chart Style 7
Waterfall Chart Style 8
Funnel Chart Style 1
Funnel Chart Style 2
Funnel Chart Style 3
Funnel Chart Style 4
Funnel Chart Style 5
Funnel Chart Style 6
Funnel Chart Style 7
Funnel Chart Style 8
Funnel Chart Style 9
Regionmap Chart Style 1
Regionmap Chart Style 2
Regionmap Chart Style 3
Regionmap Chart Style 4
Represents a color style of a chart.
The method to use to calculate the colors
AcrossLinear is not implemented yet, and will use WithinLinear
The colors to use for the calculation
The variations to use for the calculation
Represents a style for a chart
Default formatting for an axis title.
Default formatting for a category axis
Default formatting for a chart area
Default formatting for a data label
Default formatting for a data label callout
Default formatting for a data point on a 2-D chart of type column, bar, filled radar, stock, bubble, pie, doughnut, area and 3-D bubble.
Default formatting for a data point on a 3-D chart of type column, bar, line, pie, area and surface.
Default formatting for a data point on a 2-D chart of type line, scatter and radar
Default formatting for a datapoint marker
Extended marker properties for a datapoint
Default formatting for a datapoint on a surface wireframe chart
Default formatting for a Data table
Default formatting for a downbar
Default formatting for a dropline
Default formatting for an errorbar
Default formatting for a floor
Default formatting for a major gridline
Default formatting for a minor gridline
Default formatting for a high low line
Default formatting for a leader line
Default formatting for a legend
Default formatting for a chart legend
Default formatting for a plot area in a 2D chart
Default formatting for a plot area in a 3D chart
Default formatting for a series axis
Default formatting for a series line
Default formatting for a chart title
Default formatting for a trend line
Default formatting for a trend line label
Default formatting for a up bar
Default formatting for a value axis
Default formatting for a wall
The id of the chart style
A color for a chart style entry reference
Color is automatic
The index, maps to the style matrix in the theme
Manages colors for a chart style
Sets the style color for a chart style
Is index, maps to the style matrix in the theme
Sets the style color for a chart style
Is automatic
Is index, maps to the style matrix in the theme
The style color object
Reset the color
The new name
A style entry for a chart part.
Border reference.
Contains an index reference to the theme and a color to be used in border styling
Fill reference.
Contains an index reference to the theme and a fill color to be used in fills
Effect reference.
Contains an index reference to the theme and a color to be used in effects
Font reference.
Contains an index reference to the theme and a color to be used for font styling
Reference to fill settings for a chart part
Reference to border settings for a chart part
Reference to border settings for a chart part
Reference to 3D effect settings for a chart part
Reference to default text run settings for a chart part
Reference to default text body run settings for a chart part
Modifier for the chart
True if the entry has fill styles
True if the entry has border styles
True if the entry effects styles
True if the entry has 3D styles
True if the entry has text body styles
True if the entry has richtext
True if the entry has text run styles
A reference to a theme font collection from the chart style manager
The index to the style matrix.
This property referes to the theme
The color of the font
This will replace any the StyleClr node in the chart style xml.
If the reference has a color
Represents a chart style xml document in the style library
The id of the style
The Xml as string
The style xml document
Manages styles for a chart
A library where chart styles can be loaded for easier access.
EPPlus loads most buildin styles into this collection.
A library where chart color styles can be loaded for easier access
Creates an empty style and color for chart, ready to be customized
Loads the default chart style library from the internal resource library.
Loads styles, colors and the default theme.
Load all chart style library files (*.ecs) into memory from the supplied directory
Load all *.ecs files from the directory
If true, clear the library before load.
Load a single chart style library file (*.ecs) into memory
The file to load
If true, clear the library before load.
Load a single chart style library stream into memory from the supplied directory
The stream to load
If true, clear the library before load.
Loads a chart style xml file, and applies the style.
The chart style xml document
The chart color xml document
The new Id of the Style loaded
This is the style.xml and colors.xml related to the chart.xml inside a package or chart template,
e.g \xl\charts\chart1.xml
\xl\charts\style1.xml
\xl\charts\colors1.xml
Loads a crtx file and applies it to the chart. Crtx files are exported from a Spreadsheet Application like Excel.
Loading a template will only apply the styles to the chart, not change settings for the chart.
Please use the AddChartFromTemplate method to add a chart from a template file.
A crtx file
Loads a crtx file and applies it to the chart. Crtx files are exported from a Spreadsheet Application like Excel.
Loading a template will only apply the styles to the chart, not change settings for the chart, override themes etc.
Please use the AddChartFromTemplate method to add a chart from a template file.
A stream containing a crtx file
Loads a chart style xml file, and applies the style.
The build in style to fall back on
The chart style xml document
The chart colord xml document
The id of the Style loaded
Loads a theme override xml document for the chart.
The theme part
Applies a preset chart style loaded into the StyleLibrary to the chart.
The style to use
Applies a preset chart style loaded into the StyleLibrary to the chart.
The style to use
Applies a preset chart style loaded into the StyleLibrary to the chart.
This enums matches Excel's styles for single series for common scenarios.
Excel changes chart styles depending on many parameters, like number of series, axis type and more, so it will not always match the number in Excel.
To be certain of getting the correct style use the chart style number of the style you want to apply
The preset style to use
The preset color scheme to use
Applies a preset chart style loaded into the StyleLibrary to the chart.
This enums matches Excel's styles for multiple series for common scenarios.
Excel changes chart styles depending on many parameters, like number of series, axis type and more, so it will not always match the number in Excel.
To be certain of getting the correct style use the chart style number of the style you want to apply.
The preset style to use
The preset color scheme to use
Applies a chart style loaded into the StyleLibrary to the chart.
The chart style id to use
The preset color scheme id to use. Null means
Load a color xml documents
The color xml
Apply the chart and color style to the chart.
Apply the chart and color style to the chart.
A reference to style settings for the chart
A reference to color style settings for the chart
If the chart has a different theme than the theme in the workbook, this property defines that theme.
The chart style xml document
The color xml document
Overrides the current theme for the chart.
A layout the marker of the chart
The marker style
The size of the marker.
Ranges from 2 to 72
A reference from a chart style to the theme collection
The index to the theme style matrix.
The color to be used for the reference.
This will replace any the StyleClr node in the chart style xml.
If the reference has a color
The state of a check box form control
The checkbox is unchecked
The checkbox is checked
The checkbox is greyed out, neither checked or unchecked
Type of form control
A button
A check box
A combo box
A group box
A label
A list box
A radio button (option button)
A scroll bar
A spin button
An edit box. Unsupported. Editboxes can only be used in dialog sheets.
A dialog. Unsupported.
A style for a form control drop-down.
A standard combo box
An editable combo box
A standard combo box with only the drop-down button visible when the box is not expanded
Horizontal alignment for a form control. Unused in Excel 2010, so internal for now.
Left alignment
Center alignment
Right alignment
Justify alignment
Distributed alignment
String layout flow.
Text is displayed horizontally.
Text is displayed vertically.
Ideographic text is displayed horizontally.
Ideographic text is displayed vertically.
Units of measurement
Inches
Centimeters
Millimeters
Points
Picas
Pixels
English metric unit
The reading order
Reading order is determined by the first non-whitespace character
Left to Right
Right to Left
Selection type for a list control
Single selection only.
Multiple selection is allowed.
Clicking any item in the list will select or deselect that item.
Multiple selection is allowed while ctrl is used.
Text orientation in a shape
Auto orientation
Top To Bottom
Bottom To Top
Vertical Alignment for a form control
Top alignment
Center alignmet
Bottom alignment
Justify alignment
Distributed alignment
An abstract class inherited by form controls
The control property xml associated with the control
The type of form control
The name of the control
Gets or sets the alternative text for the control.
Gets or sets the macro function assigned.
The object is printed when the document is printed.
The object is locked when the sheet is protected..
If the controls fill formatting is provided automatically
If the controls size is formatted automatically.
Returns true if the object is at its default size.
If true, the object is allowed to run an attached macro
If the control has 3D effects enabled.
Gets or sets the address to the cell that is linked to the control.
The source data cell that the control object's data is linked to.
The type of drawing. Always set to
Represents a button form control
The type of form control
The buttons margin settings
The buttons text layout flow
Text orientation
The reading order for the text
If size is automatic
Text Anchoring for the text body
How the text is aligned
Represents a check box form control
The type of form control
Gets or sets the state of a check box
Represents a dialog form control. Unsupported
The type of form control
Represents a drop down form control
The type of form control
Gets or sets whether a drop-down object has a color applied to it
Gets or sets the number of lines before a scroll bar is added to the drop-down.
The style of the drop-down.
Minimum width
Represents an edit box form control. Unsupported.
The type of form control
Represents a group box form control.
The type of form control
Represents a label form control.
The type of form control
An abstract class used by form control list objects
The range to the items populating the list.
The index of a selected item in the list.
Represents a list box form control.
The type of form control
The type of selection
If is Multi or Extended this array contains the selected indicies. Index is zero based.
Margin setting for a vml drawing
Sets the margin value and unit of measurement for all margins.
Margin value to set for all margins
The unit to set for all margins. Default
Sets the margin unit of measurement for all margins.
The unit to set for all margins.
Margin is autiomatic
Left Margin
Right Margin
Top Margin
Bottom margin
Represents a radio button form control
The type of form control
Gets or sets the state of the radio box.
Gets or sets the address to the cell that is linked to the control.
Gets or sets if the radio button is the first button in a set of radio buttons
Represents a scroll bar form control
The type of form control
Gets or sets if scroll bar is horizontal or vertical
How much the scroll bar is incremented for each click
The number of items to move the scroll bar on a page click. Null is default
The value when a scroll bar is at it's minimum
The value when a scroll bar is at it's maximum
The value of the scroll bar.
Represents a spin button form control
The type of form control
How much the spin button is incremented for each click
The value when a spin button is at it's minimum
The value when a spin button is at it's maximum
The value when a spin button is at it's maximum
An abstract class used by form controls with color and line settings
Fill settings for the control
Border settings for the control
An abstract class used for formcontrols with text properties.
Text inside the shape
Richtext collection. Used to format specific parts of the text
Gets or sets whether a controls text is locked when the worksheet is protected.
Access to text body properties.
A preset bevel that can be applied to a shape.
No Bevel
Angle
Round Convex
Round
Convex
Cool slant
Cross
Divot
Hard Edge
Relaxed Inset
Riblet
Slope
Soft Round
How to render effects one on top of another
Overlay
Multiply
Screen
Darken
Lighten
The compound line type. Used for underlining text
Double lines with equal width
Single line normal width
Double lines, one thick, one thin
Double lines, one thin, one thick
Three lines, thin, thick, thin
The color type
Not specified
RGB specified in percentage
Red Green Blue
Hue, Saturation, Luminance
A system color
A color bound to a user's theme
A preset Color
A Color refering to a charts color style
The type of drawing
A unspecified drawing
A Shape drawing
A Picture drawing
A Chart drawing
A slicer drawing
A form control drawing
A drawing grouping other drawings together.
How the drawing will be resized.
The Drawing is positioned absolute to the top left corner of the worksheet and is NOT resized when rows and columns are resized.
The Drawing will move with the worksheet but is NOT resized when rows and columns are resized.
The Drawing will move and resize when rows and columns are resized.
Lend end size
Small
Medium
Large
Line end style.
No end
Triangle arrow head
Stealth arrow head
Diamond
Oval
Line arrow head
The possible directions for error bars
Error bars will be shown in the x direction
Error bars will be shown in the y direction
The possible ways to draw an error bar
The error bars will be shown in both the positive and negative directions.
The error bars will be shown in the negative direction only.
The error bars will be shown in the positive direction only
The ways to determine the length of the error bars
The length of the error bars will be determined by the Plus and Minus properties.
The length of the error bars will be the fixed value determined by Error Bar Value property.
The length of the error bars will be Error Bar Value percent of the data.
The length of the error bars will be Error Bar Value standard deviations of the data.
The length of the error bars will be Error Bar Value standard errors of the data.
Pattern styles for drawing fills
5 Percent
10 Percent
20 Percent
25 Percent
30 Percent
40 Percent
50 Percent
60 Percent
70 Percent
75 Percent
80 Percent
90 Percent
Horizontal
Vertical
Light Horizontal
Light Vertical
Dark Horizontal
Dark Vertical
Narrow Horizontal
Narrow Vertical
Dashed Horizontal
Dashed Vertical
Cross
Downward Diagonal
Upward Diagonal
Light Downward Diagonal
Light Upward Diagonal
Dark Downward Diagonal
Dark Upward Diagonal
Wide Downward Diagonal
Wide Upward Diagonal
Dashed Downward Diagonal
Dashed Upward DIagonal
Diagonal Cross
Small Checker Board
Large Checker Board
Small Grid
Large Grid
Dotted Grid
Small Confetti
Large Confetti
Horizontal Brick
Diagonal Brick
Solid Diamond
Open Diamond
Dotted Diamond
Plaid
Sphere
Weave
Divot
Shingle
Wave
Trellis
Zig Zag
The Fillstyle
No fill
A solid fill
A smooth gradual transition from one color to the next
A preset pattern fill
Picturefill
Inherited fill from the parent in the group.
Type of font
A latin font
An East Asian font
An complex font
A symbol font
The direction from which the light rig is oriented in relation to the scene.
Bottom
Bottom Left
Bottom Right
Left
Right
Top
Top Left
Top Right
The Type of Line cap
A flat line cap
A round line cap
A Square line cap
The shape that lines joined together have
A bevel join
A round join
A Mitered join
Preset line dash
Dash 1111000
Dash Dot
11110001000
Dot 1000
Large Dash
11111111000
Large Dash Dot
111111110001000
Large Dash Dot Dot
1111111100010001000
Solid
1
System Dash
1110
System Dash Dot
111010
System Dash Dot Dot
11101010
System Dot
10
Linestyle
Solid
Round
Square
Dash
Dash dot
Long dash
Long dash dot
Long dash dot dot
Horizontal Alingment
Left alignment
Center alignment
Right alignment
Vertical Alingment
Top alignment
Center alignment
Bottom alignment
Aspect ratio handling for a picture in a fill
Ignore aspect issues. Default.
Image is at least as big as Size.
Image is no bigger than Size.
Type of fill style for a vml drawing.
No fill is applied.
The fill pattern is solid.Default
The fill colors blend together in a linear gradient from bottom to top.
The fill colors blend together in a radial gradient.
The fill image is tiled.
The image is used to create a pattern using the fill colors.
The image is stretched to fill the shape.
The fill method used in a gradient fill
No sigma fill.
Linear fill.
Linear sigma fill.
Sigma fill. Default.
Any sigma fill.
Drawing object used for comments
The Id of the vml drawing
The Id of the shape drawing
Alternative text to be displayed instead of a graphic.
Anchor coordinates for the drawing
Gets a style from the semi-colo separated list with the specifik key
The list
The key to search for
The value to return
True if found
Sets the style in a semicolon separated list
The list
The key
The value
The new list
Base collection for VML drawings
Border line settings for a vml drawing
The style of the border
Dash style for the border
Custom dash style.
A series on numbers representing the width followed by the space between.
Example 1 : 8 2 1 2 1 2 --> Long dash dot dot. Space is twice the line width (2). LongDash (8) Dot (1).
Example 2 : 0 2 --> 0 implies a circular dot. 2 is the space between.
The width of the border
returns the next drawing id.
Represents a color in a vml.
A color string representing a color. Uses the HTML 4.0 color names, rgb decimal triplets or rgb hex triplets
Example:
ColorString = "rgb(200,100, 0)"
ColorString = "#FF0000"
ColorString = "Red"
ColorString = "#345" //This is the same as #334455
Sets the Color string with the color supplied.
Gets the color for the color string
Drawing object used for comments
Address in the worksheet
Vertical alignment for text
Horizontal alignment for text
If the drawing object is visible.
Background color
Linestyle for border
Line color
Width of the border
Autofits the drawingobject
If the object is locked when the sheet is protected
Specifies that the object's text is locked
From position. For comments only when Visible=true.
To position. For comments only when Visible=true.
Row position for a comment
Column position for a comment
Fill properties for the comment
Base class for vml form controls
The Text
Item height for an individual item
Number of items in a listbox.
Fill settings for a vml drawing
The type of fill used in the vml drawing
The primary color used for filling the drawing.
Opacity for fill color 1. Spans 0-100%.
Transparency is is 100-Opacity
Fill color 2.
Opacity for fill color 2. Spans 0-100%
Transparency is is 100-Opacity
Gradient specific settings used when is set to Gradient or GradientRadial.
Image and pattern specific settings used when is set to Pattern, Tile or Frame.
Recolor with picture
Rotate fill with shape
Fill settings for a vml gradient fill
A semicolon separated list of colors used for gradient fill.
Each color item starts with a percent and a color. Starting from 0% and ending and 100%.
Use to set this property.
Sets the with the colors supplied and optionally
and .
Each color item starts with a percent and a color.
Percent values must be sorted, starting from 0% and ending and 100%.
If 0% is omitted, is used.
If 100% is omitted, is used.
The colors with a percent value for the gradient fill
Gradient angle
Gradient center
Gradient method
Drawing object used for header and footer pictures
Position ID
The width in points
The height in points
Margin Left in points
Margin top in points
The Title of the image
The Image
Determines whether an image will be displayed in black and white
Determines whether a picture will be displayed in grayscale mode
Defines the intensity of all colors in an image
Default value is 1
Defines the amount of contrast for an image
Default value is 0;
Defines the intensity of black in an image
Default value is 0
A collection of vml drawings used for header and footer picturess
Indexer
Index
The VML Drawing Picture object
Number of items in the collection
returns the next drawing id.
Fill settings for a vml pattern or picture fill
Fill color 2.
Opacity for fill color 2. Spans 0-100%
Transparency is is 100-Opacity
The aspect ratio
A string representing the pictures Size.
For Example: 0,0
A string representing the pictures Origin
A string representing the pictures position
The title for the fill
The image is used when is set to Pattern, Tile or Frame.
The position of a VML drawing. Used for comments
Row. Zero based
Row offset in pixels. Zero based
Column. Zero based
Column offset. Zero based
Handles values with different measurement units.
The value of the specified unit.
The unit of measurement.
A color used in a vml gradient list
Initialize a new in instance of
If the percent is not between 0 and 100
If is Color.Empty
Percent position to insert the color. Range from 0-100
The color to use.
The pen alignment type
Center pen
Inset pen
Specifies the font pitch
Default pitch + unknown font family
Fixed pitch + unknown font family
Variable pitch + unknown font family
Default pitch + Roman font family
Fixed pitch + Roman font family
Variable pitch + Roman font family
Default pitch + Swiss font family
Fixed pitch + Swiss font family
Variable pitch + Swiss font family
Defines the preset camera that is being used.
No rotation
Isometric Bottom Down
Isometric Bottom Up
Isometric Left Down
Isometric Left Up
Isometric Off Axis 1 Left
Isometric Off Axis 1 Right
Isometric Off Axis 1 Top
Isometric Off Axis 2 Left
Isometric Off Axis 2 Right
Isometric Off Axis 2 Top
Isometric Off Axis 3 Bottom
Isometric Off Axis 3 Left
Isometric Off Axis 3 Right
Isometric Off Axis 4 Bottom
Isometric Off Axis 4 Left
Isometric Off Axis 4 Right
Isometric Right Down
Isometric Right Up
Isometric Top Down
Isometric Top Up
Legacy Oblique Bottom
Legacy Oblique Bottom Left
Legacy Oblique Bottom Right
Legacy Oblique Front
Legacy Oblique Right
Legacy Oblique Top
Legacy Oblique Top Left
Legacy Oblique Top Right
Legacy Perspective Bottom
Legacy Perspective Bottom Left
Legacy Perspective Bottom Right
Legacy Perspective Front
Legacy Perspective Left
Legacy Perspective Right
Legacy Perspective Top
Legacy Perspective Top Left
Legacy Perspective Top Right
Oblique Bottom
Oblique Bottom Left
Oblique Bottom Right
Oblique Left
Oblique Right
Oblique Top
Oblique Top Left
Oblique Top Right
Orthographic Front
Orthographic Above
Perspective Above Left Facing
Perspective Above Right Facing
Perspective Below
Perspective Contrasting Left Facing
Perspective Contrasting Right Facing
Perspective Front
Perspective Heroic Extreme Left Facing
Perspective Heroic Extreme Right Facing
Perspective Heroic Left Facing
Perspective Right Facing
Perspective Left
Perspective Relaxed
Perspective Relaxed Moderately
Perspective Right
Preset colors
Alice Blue, RGB(240,248,255)
Antique White, RGB(250,235,215)
Aqua, RGB(0,255,255)
Aquamarine, RGB(127,255,212)
Azure, RGB(240,255,255)
Beige, RGB(245,245,220)
Bisque, RGB(255,228,196)
Black, RGB(0,0,0)
Blanched Almond, RGB(255,235,205)
Blue, RGB(0,0,255)
Blue Violet, RGB(138,43,226)
Brown, RGB(165,42,42)
Burly Wood, RGB(222,184,135)
Cadet Blue, RGB(95,158,160)
Chartreuse, RGB(127,255,0)
Chocolate, RGB(210,105,30)
Coral, RGB(255,127,80)
Cornflower Blue, RGB(100,149,237)
Cornsilk, RGB(255,248,220)
Crimson, RGB(220,20,60)
Cyan, RGB(0,255,255)
Dark Blue, RGB(0,0,139)
Dark Cyan, RGB(0,139,139)
Dark Goldenrod, RGB(184,134,11)
Dark Gray, RGB(169,169,169)
Dark Green, RGB(0,100,0)
Dark Khaki, RGB(189,183,107)
Dark Magenta, RGB(139,0,139)
Dark Olive Green, RGB(85,107,47)
Dark Orange, RGB(255,140,0)
Dark Orchid, RGB(153,50,204)
Dark Red, RGB(139,0,0)
Dark Salmon, RGB(233,150,122)
Dark Sea Green, RGB(143,188,143)
Dark Slate Blue, RGB(72,61,139)
Dark Slate Gray, RGB(47,79,79)
Dark Turquoise, RGB(0,206,209)
Dark Violet, RGB(148,0,211)
Deep Pink, RGB(255,20,147)
Deep Sky Blue, RGB(0,191,255)
Dim Gray, RGB(105,105,105)
Dodger Blue, RGB(30,144,255)
Firebrick, RGB(178,34,34)
FloralWhite, RGB(255,250,240)
Forest Green, RGB(34,139,34)
Fuchsia, RGB(255,0,255)
Gainsboro, RGB(220,220,220)
GhostWhite, RGB(248,248,255)
Gold, RGB(255,215,0)
Goldenrod, RGB(218,165,32)
Gray, RGB(128,128,128)
Green, RGB(0,128,0)
Green Yellow, RGB(173,255,47)
Honeydew, RGB(240,255,240)
HotPink, RGB(255,105,180)
Indian Red, RGB(205,92,92)
Indigo, RGB(75,0,130)
Indigo, RGB(255,255,240)
Khaki, RGB(240,230,140)
Lavender, RGB(230,230,250)
Lavender Blush, RGB(255,240,245)
Lawn Green, RGB(124,252,0)
Lemon Chiffon, RGB(255,250,205)
Light Blue, RGB(173,216,230)
Light Coral, RGB(240,128,128)
Light Cyan, RGB(224,255,255)
Light Goldenrod Yellow, RGB(250,250,210)
Light Gray, RGB(211,211,211)
Light Green, RGB(144,238,144)
Light Pink, RGB(255,182,193)
Light Salmon, RGB(255,160,122)
Light Sea Green, RGB(32,178,170)
Light Sky Blue, RGB(135,206,250)
Light Slate Gray, RGB(119,136,153)
Light Steel Blue, RGB(176,196,222)
Light Yellow, RGB(255,255,224)
Lime, RGB(0,255,0)
Lime Green, RGB(50,205,50)
Linen, RGB(250,240,230)
Magenta, RGB(255,0,255)
Maroon, RGB(128,0,0)
Medium Aquamarine, RGB(102,205,170)
Medium Blue, RGB(0,0,205)
Medium Orchid, RGB(186,85,211)
Medium Purple, RGB(147,112,219)
Medium Sea Green, RGB(60,179,113)
Medium Slate Blue, RGB(123,104,238)
Medium Spring Green, RGB(0,250,154)
Medium Turquoise, RGB(72,209,204)
Medium Violet Red, RGB(199,21,133)
Midnight Blue, RGB(25,25,112)
Mint Cream, RGB(245,255,250)
Misty Rose, RGB(255,228,225)
Moccasin, RGB(255,228,181)
Navajo White, RGB(255,222,173)
Navy, RGB(0,0,128)
Old Lace, RGB(253,245,230)
Olive, RGB(128,128,0)
Olive Drab, RGB(107,142,35)
Orange, RGB(255,165,0)
Orange Red, RGB(255,69,0)
Orchid, RGB(218,112,214)
Pale Goldenrod, RGB(238,232,170)
Pale Green, RGB(152,251,152)
Pale Turquoise, RGB(175,238,238)
Pale Violet Red, RGB(219,112,147)
Papaya Whip, RGB(255,239,213)
Peach Puff, RGB(255,218,185)
Peru, RGB(205,133,63)
Pink, RGB(255,192,203)
Plum, RGB(221,160,221)
Powder Blue, RGB(176,224,230)
Purple, RGB(128,0,128)
Red, RGB(255,0,0)
Rosy Brown, RGB(188,143,143)
Royal Blue, RGB(65,105,225)
Saddle Brown, RGB(139,69,19)
Salmon, RGB(250,128,114)
Sandy Brown, RGB(244,164,96)
Sea Green, RGB(46,139,87)
Sea Shell, RGB(255,245,238)
Sienna, RGB(160,82,45)
Silver, RGB(192,192,192)
Sky Blue, RGB(135,206,235)
Slate Blue, RGB(106,90,205)
Slate Gray, RGB(112,128,144)
Snow, RGB(255,250,250)
Spring Green, RGB(0,255,127)
Steel Blue, RGB(70,130,180)
Tan, RGB(210,180,140)
Teal, RGB(0,128,128)
Thistle, RGB(216,191,216)
Tomato, RGB(255,99,71)
Turquoise, RGB(64,224,208)
Violet, RGB(238,130,238)
Wheat, RGB(245,222,179)
White, RGB(255,255,255)
White Smoke, RGB(245,245,245)
Yellow, RGB(255,255,0)
Yellow Green, RGB(154,205,50)
Preset glow types in Excel
None
Accent 1 theme color, 5pt
Accent 1 theme color, 8pt
Accent 1 theme color, 11pt
Accent 1 theme color, 18pt
Accent 2 theme color, 5pt
Accent 2 theme color, 8pt
Accent 2 theme color, 11pt
Accent 2 theme color, 18pt
Accent3 theme color, 5pt
Accent 3 theme color, 8pt
Accent 3 theme color, 11pt
Accent 3 theme color, 18pt
Accent4 theme color, 5pt
Accent 4 theme color, 8pt
Accent 4 theme color, 11pt
Accent 4 theme color, 18pt
Accent 5 theme color, 5pt
Accent 5 theme color, 8pt
Accent 5 theme color, 11pt
Accent 5 theme color, 18pt
Accent 6 theme color, 5pt
Accent 6 theme color, 8pt
Accent 6 theme color, 11pt
Accent 6 theme color, 18pt
Preset shadow types in Excel
No reflection
Tight touching
Half touching,
Full touching
Tight 4pt
Half 4pt
Full 4pt
Tight 8pt
Half 8pt
Full 8pt
Preset shadow types in Excel
No shadow
Inner top left
Inner top
Inner top right
Inner left
Inner center
Inner right
Inner bottom left
Inner bottom
Inner bottom right
Outer top left
Outer top
Outer top right
Outer left
Outer center
Outer right
Outer bottom left
Outer bottom
Outer bottom right
Perspective upper left
Perspective upper right
Perspective upper below
Perspective lower left
Perspective upper right
Preset soft edges types in Excel
No soft edges
Soft edges 1pt
Soft edges 2.5pt
Soft edges 5pt
Soft edges 10pt
Soft edges 25pt
Soft edges 50pt
Describes surface appearance of a shape
Clear
Dark Edge
Flat
Legacy Matte
Legacy Metal
Legacy Plastic
Legacy Wireframe
Matte
Metal
Plastic
Powder
Soft Edge
Soft Metal
Translucent Powder
Warm Matte
This enum indicates one of 20 preset OOXML shadow types.
This values does NOT correspond to the the preset types in Excel.
Please use the SetPresetShadow method for Excel preset types.
1. Top Left Drop Shadow, Default
2. Top Right Drop Shadow
3.
4. Back Right Perspective Shadow
5. Bottom Left Drop Shadow
6. Bottom Right Drop Shadow
7. FrontLeftPerspectiveShadow
8. Front Right Perspective Shadow
9. Top Left Small DropShadow
10. Top Left Large Drop Shadow
11. Back Left Long Perspective Shadow
Back Right Long Perspective Shadow
13. Top Left Double Drop Shadow
14. Bottom Right Small Drop Shadow
15. Front Left Long Perspective Shadow
16. Front Right LongPerspective Shadow
17. 3D Outer Box Shadow
18. 3D Inner Box Shadow
19. Back Center Perspective Shadow
20. Front Bottom Shadow
Describes how to position two rectangles relative to each other
Bottom
Bottom Left
Bottom Right
Center
Left
Right
Top
TopLeft
TopRight
The preset type of light rig which is to be applied to the 3D scene
No rig
Balanced
Bright Room
Chilly
Contrasting
Flat
Flood
Freezing
Glow
Harsh
Legacy Flat 1
Legacy Flat 2
Legacy Flat 3
Legacy Flat 4
Legacy Harsh 1
Legacy Harsh 2
Legacy Harsh 3
Legacy Harsh 4
Legacy Normal 1
Legacy Normal 2
Legacy Normal 3
Legacy Normal 4
Morning
Soft
Sunrise
Sunset
Three Point
Two Point
A color bound to a user's theme.
Semantic background color
Semantic additional text color
Semantic additional background color
Semantic text color
Extra scheme color 1
Extra scheme color 2
Extra scheme color 3
Extra scheme color 4
Extra scheme color 5
Extra scheme color 6
Regular Hyperlink Color
Followed Hyperlink Color
A color used in theme definitions which means to use the color of the style
Main Dark Color 1
Main Light Color 1
Main Dark Color 2
Main Light Color 2
The path for a gradiant color
The gradient folows a linear path
The gradient follows a circular path
The gradient follows a rectangular path
The gradient follows the shape
Shape style
Callout: with border and accent bar
Callout: with bent line and accent bar
Callout: with double bent line and accent bar
Callout: with line
Callout: with bent line
Callout: with double bent line
Action button: Back <
Action button: Begining |<
Action button: Blank
Action button: with document icon
Action button: End >|
Action button: Next >
Action button: Help ?
Action button: Home icon
Action button: Information 🛈
Action button: Camera icon
Action button: U-turn icon.
Action button: Speaker icon
Arc: Quater circle
A bent arrow
Bent connector 2
Bent connector 3
Bent connector 4
Bent connector 5
A bent up arrow
Bevel
Block arc: Half circle
Callout: Line
Callout: Bent line with border
Callout: Double bent line with border.
Brace pair: { }
Bracket pair: ( )
Callout: Line
Callout: Bent line
Callout: Double bent line
Can: A cylinder shape
A plus within a rectangle
A star within a rectangle
A x within a rectagle
Cheveron: >
Chord: The quarter of a circle.
A cirular arrow.
A cloud
Callout: Cloud
Corner: L
Cornder Tabs: Triangle in the corners.
A 3D cube shape.
Curved Connector 2
Curved Connector 3
Curved Connector 4
Curved Connector 5
Curved Arrow: Down
Curved Arrow: Left
Curved Arrow: Right
Curved Arrow: Up
A decagon: 10 corners
A diagonal stripe
A diamond shape
A Dodecagon: 12 corners
A donut shape
Double wave
A down arrow
Callout: Down arrow
An ellipse
Elipse ribbon: point up
Elipse ribbon: point down
Flow chart:
Flow chart: Collate
Flow chart: Connector
Flow chart: Decision
Flow chart: Delay
Flow chart: Display
Flow chart: Document
Flow chart: Extract
Flow chart: Input/Output Data
Flow chart: Internal Storage
Flow chart: Magnetic Disk
Flow chart: Magnetic Drum
Flow chart: Magnetic Tape
Flow chart: Manual Input
Flow chart: Manual Operation
Flow chart: Chart Merge
Flow chart: Multidocument
Flow chart: Offline Storage
Flow chart: Offpage Connector
Flow chart: Online Storage
Flow chart: Or
Flow chart: Predefined Process
Flow chart: Preparation
Flow chart: Process
Flow chart: Punched Card
Flow chart: Punched Tape
Flow chart: Sort
Flow chart: Summing Junction
Flow chart: Terminator
Folded corner, right bottom
A frame
A Funnel
Gear, six cogs
Gear, nine cogs
Half frame.
A heart
A Heptagon, 7 corners
A Hexagon, 6 corners
Home plate
A horizontal scroll
Explosion 12
Explosion 14
Left arrow
Callout: Left arrow
Left brace: {
Left bracket: (
Left circular arrow
Left Right arrow
Callout: Left rigth arrow
Left right circular arrow
Left right ribbon
Left right up arrow
Left up arrow
Lightning bold
A line, from top-left to bottom-right.
An inverted line, from top-right to bottom-left.
Math: Divide ÷
Math: Equal =
Math: Minus -
Math: Multiply x
Math: Not equal â‰
Math: Plus +
Half moon
Non Isosceles Trapezoid
No smoking, circle with line
Notched Right Arrow
Octagon, 8 corners
Parallelogram
Pentagon, 5 corners
Pie
Pie wedge
Plaque
PlaqueTabs, inverted Plaque
A plus
Quad Arrow
Callout: Quad Arrow
A rectangle
A ribbon - up
Ribbon - down
Right arrow
Callout: Right arrow
Right Brace }
Right bracket )
Rectangle - rounded top-right
Rectangle - Round top-left and bottom-right
Rectangle - Round top corners
Rectangle with rounded corners
Right triangle
Smiley face
Rectangle, snipped top-right
Rectangle, snipped top-right bottom-left
Rectangle, snipped top
Rectangle, snipped top-left, rounded top-right
Square, tabs
Star, 10
Star, 12
Star, 16
Star, 24
Star, 32
Star, 4
Star, 5
Star, 6
Star, 7
Star, 8
Streight connector
Striped right arrow
Sun
Swoosh arrow
A tear drop
Trapezoid
Triangle
Up Arrow
Callout: Up arrow
Up-down arrow
Callout: Up-down arrow
U-turn arrow
A wave
Callout Wedge: Ellipse
Callout Wedge: Rectangle
Callout Wedge: Rounded rectangle
Vertical scroll
Shape connector style
Bend connector 2
Bend connector 3
Bend connector 4
Bend connector 5
Curved connector 2
Curved connector 3
Curved connector 4
Curved connector 5
Flow chart connector
Flow chart offpage connector
Straight connector 1
Modifiers for a style entry
This style entry can be replaced with no fill
This style entry can be replaced with no line
System colors
s
Scroll Bar System Color
Background System Color
Active Caption System Color
Inactive Caption System Color
Menu System Color
Window Background System Color
Window Frame System Color
Menu Text System Color
Window Text System Color
Caption Text System Color
Active Border System Color
Inactive Border System Color
Application Workspace System Color
Highlight System Color
Highlight Text System Color
Button Face System Color
Button Shadow System Color
Gray Text System Color
Button Text System Color
Inactive Caption Text System Color
Button Highlight System Color
3D Dark System Color
3D Light System Color
Info Text System Color (Tooltip)
Info Background System Color (Tooltip)
Hot Light System Color
Gradient Active Caption System Color
Gradient Inactive Caption System Color
Menu Highlight System Color
Menu Bar System Color
Text alignment
Left alignment
Center alignment
Right alignment
Distributes the text words across an entire text line
Align text so that it is justified across the whole line.
Aligns the text with an adjusted kashida length for Arabic text
Distributes Thai text specially, specially, because each character is treated as a word
Text anchoring
Anchor the text to the bottom
Anchor the text to the center
Anchor the text so that it is distributed vertically.
Anchor the text so that it is justified vertically.
Anchor the text to the top
How autofit handles text.
No autofit
Text within the text body will be normally autofit
A shape will be autofit to fully contain the text within it
Specifies the cap types of the text
Apply all caps on the text. All lower case letters are converted to upper case, but stored without change.
None
Apply small caps to the text. Letters are converted to lower case.
Specifies the text vertical overflow
When a character doesn't fit into a line, clip it at the end.
When a character doesn't fit into a line, allow an overflow.
How text vertical overflows
Clip the text and give no indication that there is text that is not visible at the top and bottom.
Use an ellipse to highlight text that is not visible at the top and bottom.
Overflow the text.
Vertical text type
East Asian version of vertical text. Normal fonts are displayed as if rotated by 90 degrees while some East Asian are displayed vertical.
Horizontal text. Default
East asian version of vertical text. . Normal fonts are displayed as if rotated by 90 degrees while some East Asian are displayed vertical. LEFT RIGHT
All of the text is vertical orientation, 90 degrees rotated clockwise
All of the text is vertical orientation, 90 degrees rotated counterclockwise
All of the text is vertical
Vertical WordArt will be shown from right to left
Text wrapping
No wrapping. Words overflows.
Wrap words within the boundries
A color bound to a user's theme.
Main Dark Color 1
Main Light Color 1
Main Dark Color 2
Main Light Color 2
Extra scheme color 1
Extra scheme color 2
Extra scheme color 3
Extra scheme color 4
Extra scheme color 5
Extra scheme color 6
Regular Hyperlink Color
Followed Hyperlink Color
Specifies the direction(s) in which to flip the gradient while tiling
Tiles are not flipped
Tiles are flipped horizontally.
Tiles are flipped horizontally and Vertically
Tiles are flipped vertically.
Options for how to link a picture
Copy and Embed the image within the workbook
Collect the image from the link
Copy and Embed the image and add a link
Provides easy access to convert the drawing to a it's typed ExcelChart class.
Converts the drawing to it's top level or other nested drawing class.
The type of drawing. T must be inherited from ExcelDrawing
The drawing as type T
Returns return the drawing as a generic chart. This the base class for all charts.
If this drawing is not a chart, null will be returned
The drawing as a chart
Returns the drawing as an area chart.
If this drawing is not an area chart, null will be returned
The drawing as an area chart
Returns return the drawing as a bar chart.
If this drawing is not a bar chart, null will be returned
The drawing as a bar chart
Returns the drawing as a bubble chart.
If this drawing is not a bubble chart, null will be returned
The drawing as a bubble chart
Returns return the drawing as a doughnut chart.
If this drawing is not a doughnut chart, null will be returned
The drawing as a doughnut chart
Returns the drawing as a PieOfPie or a BarOfPie chart.
If this drawing is not a PieOfPie or a BarOfPie chart, null will be returned
The drawing as a PieOfPie or a BarOfPie chart
Returns the drawing as a pie chart.
If this drawing is not a pie chart, null will be returned
The drawing as a pie chart
Returns return the drawing as a line chart.
If this drawing is not a line chart, null will be returned
The drawing as a line chart
Returns the drawing as a radar chart.
If this drawing is not a radar chart, null will be returned
The drawing as a radar chart
Returns the drawing as a scatter chart.
If this drawing is not a scatter chart, null will be returned
The drawing as a scatter chart
Returns the drawing as a stock chart.
If this drawing is not a stock chart, null will be returned
The drawing as a stock chart
Returns the drawing as a surface chart.
If this drawing is not a surface chart, null will be returned
The drawing as a surface chart
Returns return the drawing as a sunburst chart.
If this drawing is not a sunburst chart, null will be returned
The drawing as a sunburst chart
Returns return the drawing as a treemap chart.
If this drawing is not a treemap chart, null will be returned
The drawing as a treemap chart
Returns return the drawing as a boxwhisker chart.
If this drawing is not a boxwhisker chart, null will be returned
The drawing as a boxwhisker chart
Returns return the drawing as a histogram chart.
If this drawing is not a histogram chart, null will be returned
The drawing as a histogram Chart
Returns return the drawing as a funnel chart.
If this drawing is not a funnel chart, null will be returned
The drawing as a funnel Chart
Returns the drawing as a waterfall chart.
If this drawing is not a waterfall chart, null will be returned
The drawing as a waterfall chart
Returns the drawing as a region map chart.
If this drawing is not a region map chart, null will be returned
The drawing as a region map chart
An Excel shape.
Connection starting point
Connection ending point
Shape connector style
Provides a simple way to type cast control drawing object top its top level class.
Converts the drawing to it's top level or other nested drawing class.
The type of drawing. T must be inherited from ExcelDrawing
The drawing as type T
Returns the drawing as a button.
If this drawing is not a button, null will be returned
The drawing as a button
Returns the drawing as a drop-down.
If this drawing is not a drop-down, null will be returned
The drawing as a drop-down
Returns the drawing as a group box.
If this drawing is not a group box, null will be returned
The drawing as a group box
Returns the drawing as a label.
If this drawing is not a label, null will be returned
The drawing as a label
Returns the drawing as a list box.
If this drawing is not a list box, null will be returned
The drawing as a list box
Returns the drawing as a check box.
If this drawing is not a check box, null will be returned
The drawing as a check box
Returns the drawing as a radio button.
If this drawing is not a radio button, null will be returned
The drawing as a radio button
Returns the drawing as a scroll bar.
If this drawing is not a scroll bar, null will be returned
The drawing as a scroll bar
Returns the drawing as a spin button.
If this drawing is not a spin button, null will be returned
The drawing as a spin button
Base class for drawings.
Drawings are Charts, Shapes and Pictures.
The ratio between EMU and Pixels
The ratio between EMU and Points
The ratio between EMU and centimeters
The ratio between EMU and milimeters
The ratio between EMU and US Inches
The ratio between EMU and pica
The type of drawing
The name of the drawing object
A description of the drawing object
How Excel resize drawings when the column width is changed within Excel.
Lock drawing
Print drawing with sheet
Top Left position, if the shape is of the one- or two- cell anchor type
Otherwise this propery is set to null
Top Left position, if the shape is of the absolute anchor type
The extent of the shape, if the shape is of the one- or absolute- anchor type.
Otherwise this propery is set to null
Bottom right position
Hyperlink
Provides access to type conversion for all top-level drawing classes.
Add new Drawing types here
The drawing collection
Xml top node
The Drawing object
Set the top left corner of a drawing.
Note that resizing columns / rows after using this function will effect the position of the drawing
Top pixel
Left pixel
How the drawing is anchored to the cells.
This effect how the drawing will be resize
This will change the cell anchor type, move and resize the drawing.
The cell anchor type to change to
The topmost pixel
The leftmost pixel
The width in pixels
The height in pixels
This will change the cell anchor type without modifiying the position and size.
The cell anchor type to change to
Set the top left corner of a drawing.
Note that resizing columns / rows after using this function will effect the position of the drawing
Start row - 0-based index.
Offset in pixels
Start Column - 0-based index.
Offset in pixels
Set size in Percent.
Note that resizing columns / rows after using this function will effect the size of the drawing
Set size in pixels
Note that resizing columns / rows after using this function will effect the size of the drawing
Width in pixels
Height in pixels
Sends the drawing to the back of any overlapping drawings.
Brings the drawing to the front of any overlapping drawings.
Group the drawing together with a list of other drawings.
The drawings to group
The group shape
Will ungroup this drawing or the entire group, if this drawing is grouped together with other drawings.
If this drawings is not grouped an InvalidOperationException will be returned.
If true this drawing will be removed from the group.
If it is false, the whole group will be disbanded. If true only this drawing will be removed.
If the drawing is grouped this property contains the Group drawing containing the group.
Otherwise this property is null
Dispose the object
Will adjust the position and size of the drawing according to changes in font of rows and to the Normal style.
This method will be called before save, so use it only if you need the coordinates of the drawing.
Copies the drawing to the supplied worksheets. The copy will be positioned using the and parameters
The worksheet where the drawing will be placed.
The top row where the drawing will be placed.
The left column where the drawing will be placed.
Row offset in pixels from the row start positions. int.MinValue
Column offset in pixels fromp the column start position
Provides a simple way to type cast drawing object top its top level class.
Converts the drawing to it's top level or other nested drawing class.
The type of drawing. T must be inherited from ExcelDrawing
The drawing as type T
Returns the drawing as a shape.
If this drawing is not a shape, null will be returned
The drawing as a shape
Returns the drawing as a picture/image.
If this drawing is not a picture, null will be returned
The drawing as a picture
An object that containing properties that type-casts the drawing to a chart.
An object that containing properties that type-casts the drawing to a slicer.
Helps to cast drawings to controls. Use the properties of this class to cast to the various specific control types.
Border for drawings
Access to fill properties
Preset line dash
The compound line type that is to be used for lines with text such as underlines
The pen alignment type for use within a text body
Specifies how to cap the ends of lines
Width in pixels
How connected lines are joined
The amount by which lines is extended to form a miter join
Otherwise miter joins can extend infinitely far.
Head end style for the line
Tail end style for the line
A connection point between a shape and a connection shape
The index the connection point
The shape to connect
Position of the a drawing.
Set xmlNodeStrings for xPath and yPath
X coordinate in EMU
EMU units 1cm = 1/360000
1US inch = 1/914400
1pt = 1/12700
1pixel = 1/9525
X coordinate in EMU
EMU units 1cm = 1/360000
1US inch = 1/914400
1pt = 1/12700
1pixel = 1/9525
Fill properties for drawing objects
Load the fill from the xml
Reference pattern fill properties
This property is only accessable when Type is set to PatternFill
Reference gradient fill properties
This property is only accessable when Type is set to BlipFill
Disposes the object
Fill properties for drawing objects like lines etc, that don't have blip- and pattern- fills
XPath
The fill xml element
The drawings collection
The fill type node.
Loads the fill from xml
Fill style
Fill color for solid fills.
Other fill styles will return Color.Empty.
Setting this propery will set the Type to SolidFill with the specified color.
Reference solid fill properties
This property is only accessable when Type is set to SolidFill
Reference gradient fill properties
This property is only accessable when Type is set to GradientFill
Transparancy in percent from a solid fill.
This is the same as 100-Fill.Transform.Alpha
Disposes the object
Properties for drawing line ends
The shapes line end decoration
The line start/end width in relation to the line width
The line start/end height in relation to the line height
A point in a 3D space
The X coordinate in point
The Y coordinate
The Z coordinate
The focus point for a non-liner gradient fill
Top offset in percentage
Bottom offset in percentage
Left offset in percentage
Right offset in percentage
Theme font collection type
Do not reference a font collection
Reference the minor font collection
Reference the major font collection
The color Scheme for a theme
Dark 1 theme color
Dark 2 theme color
Light 1 theme color
Light 2 theme color
Accent 1 theme color
Accent 2 theme color
Accent 3 theme color
Accent 4 theme color
Accent 5 theme color
Accent 6 theme color
Hyperlink theme color
Followed hyperlink theme color
The effect styles within the theme
Gets the enumerator for the collection
The enumerator
Indexer for the collection
The index
The effect style
Adds a new effect style
Removes an effect style. The collection must have at least three effect styles.
The Item
Remove the effect style at the specified index. The collection must have at least three effect styles.
The index
Number of items in the collection
Defines the font scheme within the theme
The name of the font scheme
A collection of major fonts
A collection of minor fonts
The background fill styles, effect styles, fill styles, and line styles which define the style matrix for a theme
The name of the format scheme
Defines the fill styles for the theme
Defines the line styles for the theme
Defines the effect styles for the theme
Define background fill styles for the theme
Defines a Theme within the package
The name of the theme
The base class for a theme
The Theme Xml
Defines the color scheme
Defines the font scheme
The background fill styles, effect styles, fill styles, and line styles which define the style matrix for a theme
An effect style for a theme
Effects
3D settings
Defines fill styles for a theme.
Get the enumerator for the Theme
The enumerator
Indexer for the collection
The index
The fill
Adds a new fill to the collection
The fill style
The fill
Remove a fill item
The item
Remove the item at the specified index
Number of items in the collection
A collection of fonts in a theme
The collection index
The index
Adds a normal font to the collection
The typeface, or name of the font
The script, or language, in which the typeface is supposed to be used
The font
Removes the item from the collection
The index of the item to remove
Removes the item from the collection
The item to remove
Set the latin font of the collection
The typeface, or name of the font
Set the complex font of the collection
The typeface, or name of the font
Set the East Asian font of the collection
The typeface, or name of the font
Adds a special font to the fonts collection
The font type
The typeface, or name of the font
The font
Number of items in the collection
Gets an enumerator for the collection
The enumerator
Linestyle for a theme
Line width, in EMU's
1 Pixel = 9525
1 Pt = 12700
1 cm = 360000
1 US inch = 914400
The ending caps for the line
The compound line type to be used for the underline stroke
Specifies the pen alignment type for use within a text body
Access to fill properties
Preset line dash
The shape that lines joined together have
How much lines are extended to form a miter join
Properties for drawing line head ends
Properties for drawing line tail ends
Defines the line styles within the theme
Gets the enumerator for the collection
The enumerator
Indexer for the collection
The index
The line style
Adds a new line to the collection
The line
Removes a line item from the collection
The item
Remove the line style at the specified index. The collection must have at least three line styles.
The index
Number of items in the collection
Handels themes in a package
The current theme. Null if not theme exists.
Create the default theme.
Delete the current theme
Loads a .thmx file, exported from a Spread Sheet Application like Excel
The path to the thmx file
Loads a theme XmlDocument.
Overwrites any previously set theme settings.
The theme xml
Loads a .thmx file as a stream. Thmx files are exported from a Spread Sheet Application like Excel
The thmx file as a stream
Defines a Theme override for a chart
Collection for Drawing objects.
A reference to the drawing xml document
Creates the NamespaceManager.
Get the enumerator
The enumerator
Returns the drawing at the specified position.
The position of the drawing. 0-base
Returns the drawing matching the specified name
The name of the worksheet
Number of items in the collection
The uri to the drawing xml file inside the package
Adds a new chart to the worksheet.
Stock charts cannot be added by this method. See
Type of chart
The pivottable source for a pivotchart
The top element drawingtype. Default is OneCellAnchor for Pictures and TwoCellAnchor from Charts and Shapes
The chart
Adds a new chart to the worksheet.
Do not support Stock charts .
Type of chart
The chart
Adds a new chart to the worksheet.
Type of chart
The chart
Adds a new sunburst chart to the worksheet.
The chart
Adds a new treemap chart to the worksheet.
The chart
Adds a new box & whisker chart to the worksheet.
The chart
Adds a new Histogram or Pareto chart to the worksheet.
If true a pareto line is added to the chart. The will also be Pareto.
The chart
Adds a waterfall chart to the worksheet.
The chart
Adds a funnel chart to the worksheet.
The chart
Adds a region map chart to the worksheet.
Note that EPPlus rely on the spreadsheet application to create the geocache data
The chart
Adds a new extended chart to the worksheet.
Extended charts are
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new stock chart to the worksheet.
Requires a range with four, five or six columns or rows depending on the stock chart type.
The first column/row is the category series.
The following columns/rows in the range depend on the stock chart type (HLC, OHLC, VHLC, VOHLC).
You can control if the range should be read by column or by row via the parameter.
The Stock chart type
The range containing all the series. Must match the stock chart type's expected ranges
If true the series will be read by column (left to right), if false they will be read by row (top-down)
The chart
Adds a new stock chart to the worksheet.
The stock chart type will depend on if the parameters OpenSerie and/or VolumeSerie is supplied
The category serie. A serie containng dates
The high price serie
The low price serie
The close price serie containing
The opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart
The volume represented as a column chart. Supplying this serie will create a StockVHLC or StockVOHLC chart
The chart
Adds a new stock chart to the worksheet.
The stock chart type will depend on if the parameters OpenSerie and/or VolumeSerie is supplied
The category serie. A serie containing dates
The high price serie
The low price serie
The close price serie containing
The opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart
The volume represented as a column chart. Supplying this serie will create a StockVHLC or StockVOHLC chart
The chart
Add a new linechart to the worksheet.
Type of linechart
The chart
Adds a new linechart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Add a new area chart to the worksheet.
Type of linechart
The chart
Adds a new area chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new barchart to the worksheet.
Type of linechart
The chart
Adds a new column- or bar- chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new pie chart to the worksheet.
Type of chart
The chart
Adds a new pie chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new doughnut chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new doughnut chart to the worksheet.
Type of chart
The chart
Adds a new line chart to the worksheet.
Type of chart
The chart
Add a new pie of pie or bar of pie chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new bubble chart to the worksheet.
Type of chart
The chart
Adds a new bubble chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new scatter chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new scatter chart to the worksheet.
Type of chart
The chart
Adds a new radar chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new radar chart to the worksheet.
Type of chart
The chart
Adds a new surface chart to the worksheet.
Type of chart
The pivottable source for a pivotchart
The chart
Adds a new surface chart to the worksheet.
Type of chart
The chart
Adds a picture to the worksheet
The name of the drawing object
The path to the image file
Location to access the image from
A picture object
Adds a picture to the worksheet
The name of the drawing object
The path to the image file
Picture Hyperlink
Location to access the image from
A picture object
Adds a picture to the worksheet
The image file
Location to access the image from
A picture object
Adds a picture to the worksheet
The image file
Picture Hyperlink
Location to access the image from
A picture object
Adds a picture to the worksheet using a stream. EPPlus will identify the type of image automatically.
An stream image.
A picture object
Adds a picture to the worksheet from a stream. EPPlus will identify the type of image automatically.
An stream image.
The Picture Hyperlink
A picture object
Adds a picture to the worksheet
An stream image.
The type of image. A null value means that EPPlus will identify the type of image automatically.
A picture object
Adds a picture to the worksheet
An stream image.
The type of image. A null value means that EPPlus will identify the type of image automatically.
Picture Hyperlink
A picture object
Adds a picture to the worksheet
The image file
Location to access the image from
A picture object
Adds a picture to the worksheet
The image file
Picture Hyperlink
Location to access the image from
A picture object
Adds a picture to the worksheet
The path to the image file
Location to access the image from
A picture object
Adds a picture to the worksheet
The path to the image file
Picture Hyperlink
Location to access the image from
A picture object
Adds a picture to the worksheet from a stream. EPPlus will identify the type of image automatically.
An stream image.
A picture object
Adds a picture to the worksheet from a stream. EPPlus will identify the type of image automatically.
An stream image.
The Picture Hyperlink
A picture object
Adds a picture to the worksheet
An stream image.
The type of image. A null value means that EPPlus will identify the type of image automatically.
A picture object
Adds a picture to the worksheet
An stream image.
The type of image. A null value means that EPPlus will identify the type of image automatically.
The Picture Hyperlink
A picture object
Adds a new chart using an crtx template
The crtx file
The name of the chart
The new chart
Adds a new chart using an crtx template
The crtx file
The name of the chart
Pivot table source, if the chart is a pivottable
The new chart
Adds a new chart using an crtx template
The crtx file as a stream
The name of the chart
The new chart
Adds a new chart using an crtx template
The crtx file as a stream
The name of the chart
Pivot table source, if the chart is a pivottable
The new chart
Adds a new shape to the worksheet
Name
Shape style
The shape object
Adds a slicer to a table column
The table column
The slicer drawing
Adds a slicer to a pivot table field
The pivot table field
The slicer drawing
Adds a new shape to the worksheet
Name
Source shape
The shape object
Adds a form control to the worksheet
The name
The type of control
Chart sheets cannot have controls
Drawing names must be unique
Adds a button form control to the worksheet
The name of the button
The button form control
Adds a checkbox form control to the worksheet
The name of the checkbox control
The checkbox form control
Adds a radio button form control to the worksheet
The name of the radio button control
The radio button form control
Adds a list box form control to the worksheet
The name of the list box control
The list box form control
Adds a drop-down form control to the worksheet
The name of the drop-down control
The drop-down form control
Adds a group box form control to the worksheet
The name of the group box control
The group box form control
Adds a label form control to the worksheet
The name of the label control
The label form control
Adds a spin button control to the worksheet
The name of the spin button control
The spin button form control
Adds a scroll bar control to the worksheet
The name of the scroll bar control
The scroll bar form control
Removes a drawing.
The index of the drawing
Removes a drawing.
The drawing
Removes a drawing.
The name of the drawing
Removes all drawings from the collection
Disposes the object
Read the drawings coordinates, height and width.
The size of the drawing
Update height and width via colOffPath and rowOffPath
Column Offset
EMU units 1cm = 1/360000
1US inch = 1/914400
1pixel = 1/9525
Row Offset
EMU units 1cm = 1/360000
1US inch = 1/914400
1pixel = 1/9525
A coordinate in 3D space.
XPath
The latitude value of the rotation
The longitude value of the rotation
The revolution around the central axis in the rotation
All values are required, so init them on any set.
A collection of child drawings to a group drawing
Adds a drawing to the group
Disposes the class
Number of items in the collection
Returns the drawing at the specified position.
The position of the drawing. 0-base
Returns the drawing matching the specified name
The name of the worksheet
Gets the enumerator for the collection
The enumerator
Removes the from the group
The drawing to remove
Removes all children drawings from the group.
Grouped shapes
A collection of shapes
The type of drawing
Represents an image
Creates an ExcelImage to be used as template for adding images.
Creates an ExcelImage to be used as template for adding images.
A path to the image file to load
Creates an ExcelImage to be used as template for adding images.
A FileInfo referencing the image file to load
Creates an ExcelImage to be used as template for adding images.
The stream containing the image
The type of image loaded in the stream
Creates an ExcelImage to be used as template for adding images.
The image as a byte array
The type of image loaded in the stream
If this object contains an image.
The type of image.
The image as a byte array.
The image bounds and resolution
Sets a new image.
The path to the image file.
Sets a new image.
The image file.
Sets a new image.
The image as a byte array.
The type of image.
Sets a new image.
The image object to use.
Sets a new image.
The stream containing the image.
The type of image.
Sets a new image.
The stream containing the image.
The type of image.
Sets a new image.
The path to the image file.
Sets a new image.
The image file.
Information about the content, type, bounds and resolution of an image.
The width of the image
The height of the image
The horizontal resolution of the image
The vertical resolution of the image
An image object
The type of drawing
The image
Set the size of the image in percent from the orginal size
Note that resizing columns / rows after using this function will effect the size of the picture
Percent
Access to Fill properties
Access to Fill properties
Effects
Relative to original picture size
Lock aspect ratio
Dispose the object
Rotation angle in degrees. Positive angles are clockwise. Negative angles are counter-clockwise.
Note that EPPlus will not size the image depending on the rotation, so some angles will reqire the and coordinates to be set accordingly.
If true, flips the picture horizontal about the center of its bounding box.
If true, flips the picture vertical about the center of its bounding box.
Position of the a drawing.
The column
The row
Column Offset in EMU
ss
EMU units 1cm = 1/360000
1US inch = 1/914400
1pixel = 1/9525
Row Offset in EMU
EMU units 1cm = 1/360000
1US inch = 1/914400
1pixel = 1/9525
Load xml data
Update xml data
An Excel shape.
Base class for drawing-shape objects
The type of drawing
Shape style
Access Fill properties
Access to Border propesties
Drawing effect properties
Defines 3D properties to apply to an object
Head line end
Tail line end
Font properties
Text inside the shape
Lock drawing
Richtext collection. Used to format specific parts of the text
Text Anchoring
The centering of the text box.
How the text is aligned
Indentation
Rotation angle in degrees. Positive angles are clockwise. Negative angles are counter-clockwise.
If true, flips the shape horizontal about the center of its bounding box.
If true, flips the shape vertical about the center of its bounding box.
Vertical text
Access to text body properties.
Provides easy type cast for slicer drawings.
Returns the drawing as table slicer .
If this drawing is not a table slicer, null will be returned
The drawing as a table slicer
Returns the drawing as pivot table slicer .
If this drawing is not a pivot table slicer, null will be returned
The drawing as a pivot table slicer
3D settings
Degree of perspective
Rotation X-axis
Rotation Y-axis
Right Angle Axes
Depth % of base
Height % of base
The internal generic handler for image formats used in EPPlus.
Supported types by the image handler
The last exception that occured when calling
Retreives the image bounds and resolution for an image
The image data
Type type of image
The width of the image
The height of the image
The horizontal resolution in DPI
The vertical resolution in DPI
Returns if the handler is valid for the enviornment.
The generic image handler is valid in all environments, so it will always return true.
Interface for handling data labels
Data labels
If the chart part has data labels
Interface for handling data labels on a serie
Data labels
If the chart part has data labels
Interface to handle styles on a chart part
Create the spPr element within the drawing part if does not exist.
Border settings
Effect settings
Fill settings
3D settings
Interface to handle font styles on a chart part
Font settings
Text body settings
Represents a pivot table slicer drawing object.
A pivot table slicer is attached to a pivot table fields item filter.
Represents a pivot table slicer cache.
Init must be called before accessing any properties as it sets several properties.
The source type of the slicer
A collection of pivot tables attached to the slicer cache.
Tabular data for a pivot table slicer cache.
Tabular data for a pivot table slicer cache.
How the items that are used in slicer cross filtering are displayed
How the table slicer items are sorted
If custom lists are used when sorting the items
If the source pivottable has been deleted.
The items of the slicer.
Note that the sort order of this collection is the same as the pivot table field items, not the sortorder of the slicer.
Showing/hiding items are reflects to the pivot table(s) field items collection.
The pivot table cache id
Represents a pivot table slicer item.
The value of the item
If the value is hidden
A collection of items in a pivot table slicer.
Refresh the items from the shared items or the group items.
Get the enumerator for the collection
Get the enumerator for the collection
Number of items in the collection.
Get the value at the specific position in the collection
The position
Get the item with supplied value.
The value
The item matching the supplied value. Returns null if no value matches.
Get the index of the item with supplied value.
The value
The item matching the supplied value. Returns -1 if no value matches.
It the object exists in the cache
The object to check for existance
Base class for table and pivot table slicers.
The slicer cache data type
The type of drawing
The caption text of the slicer.
If the caption of the slicer is visible.
The the name of the slicer.
Row height in points
The index of the starting item in the slicer. Default is 0.
Number of columns. Default is 1.
If the slicer view is locked or not.
The build in slicer style.
If set to Custom, the name in the is used
The style name used for the slicer.
A reference to the slicer cache.
Base class for table and pivot table slicer caches
The slicer cache xml document
The name of the slicer cache
The name of the source field or column.
The source of the slicer.
A collection of pivot tables attached to a slicer
Get an Enumerator for the collection.
The Enumerator
Get an Enumerator for the collection.
The Enumerator
The indexer for the collection
The index
The pivot table at the specified index
Adds a new pivot table to the collection. All pivot table in this collection must share the same cache.
The pivot table to add
Number of items in the collection
Represents a table slicer drawing object.
A table slicer is attached to a table column value filter.
The table column that the slicer is connected to.
The value filters for the slicer. This is the same filter as the filter for the table.
This filter is a value filter.
Represents a slicer cache with a table as source
The source type for the slicer cache
The table column that is the source for the slicer
How the table slicer items are sorted
How the items that are used in slicer cross filtering are displayed
If custom lists are used when sorting the items
If true, items that have no data are not displayed
A named table style that applies to tables only
The name of the table named style
Applies to the entire content of a table or pivot table
Applies to the header row of a table or pivot table
Applies to slicer item that is selected
Applies to a select slicer item with no data.
Applies to a slicer item with data that is not selected
Applies to a slicer item with no data that is not selected
Applies to a selected slicer item with data and over which the mouse is paused on
Applies to a selected slicer item with no data and over which the mouse is paused on
Applies to a slicer item with data that is not selected and over which the mouse is paused on
Applies to a selected slicer item with no data and over which the mouse is paused on
A style element for a custom slicer style
Access to style settings
The type of the slicer element that this style is applied to.
A type specifing the type of style element for a named custom slicer style.
Styles a slicer item with data that is not selected
Styles a slicer item that is selected
Styles a slicer item with no data that is not selected
Styles a select slicer item with no data.
Styles a slicer item with data that is not selected and over which the mouse is paused on
Styles a selected slicer item with data and over which the mouse is paused on
Styles a slicer item with no data that is not selected and over which the mouse is paused on
Styles a selected slicer item with no data and over which the mouse is paused on
Datatypes for color transformation types
Percentage
Positive percentage
Fixed percentage
Fixed positive percentage
An angel
Fixed angle, ranges from -90 to 90
A booleans
Type of color transformation.
See OOXML documentation section 20.1.2.3 for more detailed information.
A lighter version of its input color.
A darker version of its input color
The color rendered should be the complement of its input color
The inverse of its input color
A grayscale of its input color
Apply an opacity to the input color
Apply a more or less opaque version of the input color
The opacity as expressed by a percentage offset increase or decrease of the input color
Sets the hue
The input color with its hue shifted
The input color with its hue modulated by the given percentage
Sets the saturation
The saturation as expressed by a percentage offset increase or decrease of the input color
The saturation as expressed by a percentage relative to the input color
Sets the luminance
The luminance as expressed by a percentage offset increase or decrease of the input color
The luminance as expressed by a percentage relative to the input color
Sets the red component
The red component as expressed by a percentage offset increase or decrease of the input color
The red component as expressed by a percentage relative to the input color
Sets the green component
The green component as expressed by a percentage offset increase or decrease of the input color
The green component as expressed by a percentage relative to the input color
Sets the blue component
The blue component as expressed by a percentage offset increase or decrease to the input color
The blue component as expressed by a percentage relative to the input color
Gamma shift of the input color
Inverse gamma shift of the input color
Color transformation
For internal transformation calculations only.
Indexer for the colletion
The position in the list
Clear all items
Remote item at a specific position
The postion in the list
Removes the specific item
The item to remove
Remove all items of a specific type
The transformation type
The opacity as expressed by a percentage value
Alpha equals 100-Transparancy
The alpha value in percentage 0-100
Specifies a more or less opaque version of its input color
Alpha equals 100-Transparancy
The alpha modulation in a positive percentage
Adds an alpha offset value.
The tint percentage. From 0-100
Specifies the input color with the specified hue, but with its saturation and luminance unchanged
The hue angle from 0-360
Specifies the hue as expressed by a percentage relative to the input color
The hue modulation in a positive percentage
Specifies the actual angular value of the shift. The result of the shift shall be between 0 and 360 degrees.Shifts resulting in angular values less than 0 are treated as 0.
Shifts resulting in angular values greater than 360 are treated as 360.
The hue offset value.
Specifies the input color with the specified saturation, but with its hue and luminance unchanged
The saturation percentage from 0-100
Specifies the saturation as expressed by a percentage relative to the input color
The saturation modulation in a positive percentage
Specifies the saturation as expressed by a percentage offset increase or decrease to the input color.
Increases never increase the saturation beyond 100%, decreases never decrease the saturation below 0%.
The saturation offset value
Specifies the input color with the specified luminance, but with its hue and saturation unchanged
The luminance percentage from 0-100
Specifies the luminance as expressed by a percentage relative to the input color
The luminance modulation in a positive percentage
Specifies the luminance as expressed by a percentage offset increase or decrease to the input color.
Increases never increase the luminance beyond 100%, decreases never decrease the saturation below 0%.
The luminance offset value
Specifies the input color with the specific red component
The red value
Specifies the red component as expressed by a percentage relative to the input color component
The red modulation value
Specifies the red component as expressed by a percentage offset increase or decrease to the input color component
The red offset value.
Specifies the input color with the specific green component
The green value
Specifies the green component as expressed by a percentage relative to the input color component
The green modulation value
Specifies the green component as expressed by a percentage offset increase or decrease to the input color component
The green offset value.
Specifies the input color with the specific blue component
The blue value
Specifies the blue component as expressed by a percentage relative to the input color component
The blue modulation value
Specifies the blue component as expressed by a percentage offset increase or decrease to the input color component
The blue offset value.
Specifies a lighter version of its input color
The tint value in percentage 0-100
Specifies a lighter version of its input color
The tint value in percentage 0-100
Specifies that the color rendered should be the complement of its input color with the complement being defined as such.
Two colors are called complementary if, when mixed they produce a shade of grey.For instance, the complement of red which is RGB (255, 0, 0) is cyan which is RGB(0, 255, 255)
Specifies that the output color rendered by the generating application should be the sRGB gamma shift of the input color.
Specifies a grayscale of its input color, taking into relative intensities of the red, green, and blue primaries.
Specifies the inverse of its input color
Specifies that the output color rendered by the generating application should be the inverse sRGB gamma shift of the input color
Gets the enumerator for the collection
The enumerator
Number of items in the collection
Different types of transformation performed on a color
The type of transformation
Datatype for color transformation
The value of the color tranformation
Converts the object to a string
The type
A tranformation operation for a color
Type of tranformation
The datatype of the value
The value
Handles colors for drawings
If type is set to SchemeColor, then this property contains the scheme color
Set the color to a scheme color
The scheme color
Reset the colors on the object
The new color new name
Represents a HSL color
The hue angle in degrees.
Ranges from 0 to 360
The saturation percentage
The luminance percentage
Represents a preset color
The preset color
Represents a RGB color
The color
s
A color using the red, green, blue RGB color model.
Each component, red, green, and blue is expressed as a percentage from 0% to 100%.
A linear gamma of 1.0 is assumed
The percentage of red.
The percentage of green.
The percentage of blue.
Represents a scheme color
The scheme color
Represents a system color
s
The system color
Last color computed.
Manages colors in a theme
Namespace manager
The top node
The node of the supplied path
The node of the color object
Init method
The x-path
Order of the elements according to the xml schema
The type of color.
Each type has it's own property and set-method.
Color transformations
A rgb color.
This property has a value when Type is set to Rgb
A rgb precentage color.
This property has a value when Type is set to RgbPercentage
A hsl color.
This property has a value when Type is set to Hsl
A preset color.
This property has a value when Type is set to Preset
A system color.
This property has a value when Type is set to System
Sets a rgb color.
The color
Apply the alpha part of the Color to the collection
Sets a rgb precentage color
Red percentage
Green percentage
Bluepercentage
Sets a hsl color
The hue angle. From 0-360
The saturation percentage. From 0-100
The luminance percentage. From 0-100
Sets a preset color.
Must be a named color. Can't be color.Empty.
Color
Sets a preset color.
The color
Sets a system color
The colors
Reset the color objects
The new color node name
Color transformation item
Type of tranformation
Datetype of the value property
The value
A blur effect that is applied to the shape, including its fill
The radius of blur in points
If the bounds of the object will be grown as a result of the blurring.
Default is true
A color change effect
The color to transform from
The color to transform to
A color change effect
The color to replace with
A Duotune effect
The first color
The second color
Base class for all drawing effects
Completely remove the xml node, resetting the properties to it's default values.
Effect styles of a drawing object
The blur effect
The fill overlay effect. A fill overlay can be used to specify an additional fill for a drawing and blend the two together.
The glow effect. A color blurred outline is added outside the edges of the drawing
The inner shadow effect. A shadow is applied within the edges of the drawing.
The outer shadow effect. A shadow is applied outside the edges of the drawing.
The preset shadow effect.
The reflection effect.
Soft edge radius. A null value indicates no radius
If the drawing has any inner shadow properties set
If the drawing has any outer shadow properties set
If the drawing has any preset shadow properties set
If the drawing has any blur properties set
If the drawing has any glow properties set
If the drawing has any fill overlay properties set
Set a predefined glow matching the preset types in Excel
The preset type
Set a predefined glow matching the preset types in Excel
The preset type
Set a predefined shadow matching the preset types in Excel
The preset type
Set a predefined glow matching the preset types in Excel
The preset type
The fill overlay effect.
A fill overlay can be used to specify an additional fill for a drawing and blend the two together.
The fill to blend with
How to blend the overlay
Default is Over
Creates a fill overlay with BlendMode = Over
Removes any fill overlay
The glow effect, in which a color blurred outline is added outside the edges of the drawing
The color of the glow
The radius of the glow in pixels
The inner shadow effect. A shadow is applied within the edges of the drawing.
The blur radius.
The outer shadow effect. A shadow is applied outside the edges of the drawing.
The shadow alignment
If the shadow rotates with the shape
Horizontal skew angle.
Ranges from -90 to 90 degrees
Vertical skew angle.
Ranges from -90 to 90 degrees
Horizontal scaling factor in percentage.
A negative value causes a flip.
Vertical scaling factor in percentage.
A negative value causes a flip.
A preset shadow types
The preset shadow type
The reflection effect
The start position along the alpha gradient ramp of the alpha value.
The starting reflection opacity
The end position along the alpha gradient ramp of the alpha value.
The ending reflection opacity
The direction to offset the reflection
Alignment
If the shadow rotates with the shape
Horizontal skew angle.
Ranges from -90 to 90 degrees
Vertical skew angle.
Ranges from -90 to 90 degrees
Horizontal scaling factor in percentage .
A negative value causes a flip.
Vertical scaling factor in percentage .
A negative value causes a flip.
The direction to offset the shadow
The blur radius.
The shadow effect applied to a drawing
The color of the shadow effect
The direction angle to offset the shadow.
Ranges from 0 to 360
Inizialize the xml
Base class for shadow effects
How far to offset the shadow is in pixels
This class contains translation between enums and the actual xml values.
Effects added to a blip fill
Adds a duotone effect
Removes a duotone effect.
A duo tone color effect.
Adds a color change effect
Removes a duotone effect.
A duo tone color effect.
Adds a color change effect
Removes a duotone effect.
Adds color replacement effect.
A picture fill for a drawing
The image used in the fill operation.
The image should be stretched to fill the target.
Offset in percentage from the edge of the shapes bounding box. This property only apply when Stretch is set to true.
The portion of the image to be used for the fill.
Offset values are in percentage from the borders of the image
The image should be tiled to fill the available space
The type of fill
Blip fill effects
A BLIP will be tiled to fill the available space
The direction(s) in which to flip the image.
Where to align the first tile with respect to the shape.
The ratio for horizontally scale
The ratio for vertically scale
The horizontal offset after alignment
The vertical offset after alignment
Base class for drawing fills
Creates an instance of ExcelDrawingFillBase
Creates an instance of ExcelDrawingFillBase
Namespace manager
The top node
XPath to the fill
Xml initialize method
Type of fill
Internal Check for type change
The type
The Xml helper
The top node
The name space manager
The XPath
Init xml
Xml namespace manager
The node
The fill path
Create the Xml Helper
A gradient fill. This fill gradual transition from one color to the next.
s
The direction(s) in which to flip the gradient while tiling
If the fill rotates along with shape.
A list of colors and their positions in percent used to generate the gradiant fill
The fill style.
Specifies the shape of the path to follow
The focuspoint when ShadePath is set to a non linear value.
This property is set to null if ShadePath is set to Linear
Linear gradient settings.
This property is set to null if ShadePath is set to Linear
Represents a color in the gradiant color list
The position of color in a range from 0-100%
The color to use.
A collection of colors and their positions used for a gradiant fill.
Indexer for the collection
The index in the collection
The color
Number of items in the collection
Gets the first occurance with the color with the specified position
The position in percentage
The color
Adds a RGB color at the specified position
The position
The Color
Adds a RGB percentage color at the specified position
The position
The percentage of red
The percentage of green
The percentage of blue
Adds a theme color at the specified position
The position
The theme color
Adds a system color at the specified position
The position
The system color
Adds a HSL color at the specified position
The position
The hue part. Ranges from 0-360
The saturation part. Percentage
The luminance part. Percentage
Adds a HSL color at the specified position
The position
The preset color
Gets the enumerator for the collection
The enumerator
Settings specific for linear gradiant fills
The direction of color change for the gradient.To define this angle, let its value
be x measured clockwise.Then( -sin x, cos x) is a vector parallel to the line of constant color in the gradient fill.
If the gradient angle scales with the fill.
The drawing has no fill
The type of fill
A pattern fill.
The fillstyle, always PatternFill
The preset pattern to use
Foreground color
Background color
A solid fill.
The fill style
The color of the fill
Represents a normal font
The script or language
Base class a font
The typeface or the name of the font
Represents a special font, Complex, Latin or East asian
The type of font
Specifies the Panose-1 classification number for the current font using the mechanism
defined in §5.2.7.17 of ISO/IEC 14496-22.
This value is used as one piece of information to guide selection of a similar alternate font if the desired font is unavailable.
The font pitch as well as the font family for the font
3D settings for a drawing object
Defines scene-level 3D properties to apply to an object
The height of the extrusion
The height of the extrusion
The bevel on the top or front face of a shape
The bevel on the top or front face of a shape
The color of the extrusion applied to a shape
The color for the contour on a shape
The surface appearance of a shape
The z coordinate for the 3D shape
Remove all 3D settings
Defines a bevel off a shape
The width of the bevel in points (pt)
The height of the bevel in points (pt)
A preset bevel that can be applied to a shape.
3D Text settings
The Z coordinate to be used when positioning the flat text within the 3D scene
Scene-level 3D properties to apply to a drawing
The xpath
The placement and properties of the camera in the 3D scene
The light rig.
When 3D is used, the light rig defines the lighting properties for the scene
The points and vectors contained within the backdrop define a plane in 3D space
The points and vectors contained within the backdrop define a plane in 3D space
The anchor point
The up vector
The normal vector
Settings for the camera in the 3D scene
The XPath
Defines a rotation in 3D space
An override for the default field of view for the camera.
The preset camera type that is being used.
The zoom factor of a given camera
The lightrig
When 3D is used, the light rig defines the lighting properties associated with the scene
The xpath
Defines a rotation in 3D space
The direction from which the light rig is oriented in relation to the scene.
The preset type of light rig which is to be applied to the 3D scene
Properties for the textbody
The anchoring position within the shape
The centering of the text box.
Underlined text
The bottom inset of the bounding rectangle
The top inset of the bounding rectangle
The right inset of the bounding rectangle
The left inset of the bounding rectangle
The rotation that is being applied to the text within the bounding box
The space between text columns in the text area
If the before and after paragraph spacing defined by the user is to be respected
If the line spacing is decided in a simplistic manner using the font scene
Forces the text to be rendered anti-aliased
If the text within this textbox is converted from a WordArt object.
If the text should be displayed vertically
If the text can flow out horizontaly
If the text can flow out of the bounding box vertically
How text is wrapped
The text within the text body should be normally auto-fited
The percentage of the original font size to which each run in the text body is scaled.
This propery only applies when the TextAutofit property is set to NormalAutofit
The percentage by which the line spacing of each paragraph is reduced.
This propery only applies when the TextAutofit property is set to NormalAutofit
A richtext part
The capitalization that is to be applied
The minimum font size at which character kerning occurs
Fontsize
Spans from 0-4000
The spacing between between characters
The baseline for both the superscript and subscript fonts in percentage
Bold text
Italic text
Strike-out text
Underlined text
How the items that are used in slicer cross filtering are displayed
The slicer style for slicer items with no data is not applied to slicer items with no data, and slicer items with no data are not sorted separately in the list of slicer items in the slicer view.
The slicer style for slicer items with no data is applied to slicer items with no data, and slicer items with no data are sorted at the bottom in the list of slicer items in the slicer view.
The slicer style for slicer items with no data is applied to slicer items with no data, and slicer items with no data are not sorted separately in the list of slicer items in the slicer view.
The source of the slicer data
A pivot table
A table
Buildin slicer styles
No slicer style specified
A custom style set by the property
Light 1 style
Light 2 style
Light 3 style
Light 4 style
Light 5 style
Light 6 style
Other 1 style
Other 2 style
Dark 1 style
Dark 2 style
Dark 3 style
Dark 4 style
Dark 5 style
Dark 6 style
Sorting
Sort ascending, default
Sort descending
Dash style for a line used in VML drawings
A solid line
Short - Dash
Short - Dot
Short - Dash - Dot
Short - Dash - Dot - Dot
Dotted
Dashed
Long dashes
Dash - Dot
Long Dash - Dot
Long Dash - Dot - Dot
Custom dash style.
The line style of a vml drawing
No line style
A single line
Thin thin line style
Thin thick line style
Thick thin line style
Thick between thin line style
Handels encrypted Excel documents
Read the package from the OLE document and decrypt it using the supplied password
The file
Read the package from the OLE document and decrypt it using the supplied password
The memory stream.
The encryption object from the Package
Encrypts a package
The package as a byte array
The encryption info from the workbook
Create an EncryptionInfo object to encrypt a workbook
The password
The Encryption key
Decrypt a document
The Encrypted data
Encryption Info object
The password
Validate the password
The encryption key
The encryption info extracted from the ENCRYPTIOINFO stream inside the OLE document
Validate the password
The hash algorithm
The encryption info extracted from the ENCRYPTIOINFO stream inside the OLE document
Create the hash.
This method is written with the help of Lyquidity library, many thanks for this nice sample
The password
The encryption info extracted from the ENCRYPTIOINFO stream inside the OLE document
The hash to encrypt the document
Create the hash.
This method is written with the help of Lyquidity library, many thanks for this nice sample
The password
The encryption info extracted from the ENCRYPTIOINFO stream inside the OLE document
The block key appended to the hash to obtain the final hash
The hash to encrypt the document
Encryption Header inside the EncryptionInfo stream
AES. MUST conform to the AES algorithm.
RC2. MUST conform to [RFC2268].
RC4.
MUST conform to the DES algorithm.
MUST conform to the [DRAFT-DESX] algorithm.
3DES. MUST conform to the [RFC1851] algorithm.
3DES_112 MUST conform to the [RFC1851] algorithm.
Cipher block chaining (CBC).
Cipher feedback chaining (CFB), with 8-bit window.
Hash algorithm
Sha 1-MUST conform to [RFC4634]
Sha 256-MUST conform to [RFC4634]
Sha 384-MUST conform to [RFC4634]
Sha 512-MUST conform to [RFC4634]
MD5
MD4
MD2
RIPEMD-128 MUST conform to [ISO/IEC 10118]
RIPEMD-160 MUST conform to [ISO/IEC 10118]
WHIRLPOOL MUST conform to [ISO/IEC 10118]
Handels the agile encryption
Handles the EncryptionInfo stream
Encryption verifier inside the EncryptionInfo stream
Tells how cells should be shifted in a delete operation
Cells in the range are shifted to the left
Cells in the range are shifted upwards
The range for the entire row is used in the shift operation
The range for the entire column is used in the shift operation
Tells how cells should be shifted in a insert operation
Cells in the range are shifted to the right
Cells in the range are shifted downwards
The range for the entire row is used in the shift operation
The range for the entire column is used in the shift operation
Algorithm for password hash
Specifies that the MD2 algorithm, as defined by RFC 1319, shall be used.
Specifies that the MD4 algorithm, as defined by RFC 1319, shall be used.
Specifies that the MD5 algorithm, as defined by RFC 1319, shall be used.
Specifies that the RIPEMD-128 algorithm, as defined by RFC 1319, shall be used.
Specifies that the RIPEMD-160 algorithm, as defined by ISO/IEC10118-3:2004 shall be used.
Specifies that the SHA-1 algorithm, as defined by ISO/IEC 10118-3:2004 shall be used.
Specifies that the SHA-256 algorithm, as defined by ISO/IEC10118-3:2004 shall be used.
Specifies that the SHA-384 algorithm, as defined by ISO/IEC 10118-3:2004 shall be used.
Specifies that the SHA-512 algorithm, as defined by ISO/IEC10118-3:2004 shall be used.
Specifies that the WHIRLPOOL algorithm, as defined by ISO/IEC 10118-3:2004 shall be used.
Maps to DotNetZips CompressionLevel enum
Level 0, no compression
No compression
Level 1, Best speen
Level 2
Level 3
Level 4
Level 5
Level 6
Default, Level 6
Level 7
Level 8
Level 9
Best compression, Level 9
Specifies with license EPPlus is used under.
Licensetype must be specified in order to use the library
You comply with the Polyform Non Commercial License.
See https://polyformproject.org/licenses/noncommercial/1.0.0/
You have a commercial license purchased at https://epplussoftware.com/licenseoverview
Worksheet hidden enumeration
The worksheet is visible
The worksheet is hidden but can be shown by the user via the user interface
The worksheet is hidden and cannot be shown by the user via the user interface
Range address with the address property readonly
Constructor
From row
From column
To row
To column
Constructor
Worksheet name
From row
From column
To row
To column
Constructor
The Excel address
Creates an Address object
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
The Excel Address
Reference to the package to find information about tables and names
The address
The address for the range
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
A range address
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
Creates an Address object
start row
start column
End row
End column
Creates an Address object
Worksheet name
Start row
Start column
End row
End column
Creates an address object
Index of an external reference
Worksheet name
Start row
Start column
End row
End column
Creates an Address object
Start row
Start column
End row
End column
Start row fixed
Start column fixed
End row fixed
End column fixed
Creates an Address object
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
The Excel Address
The workbook to verify any defined names from
The name of the worksheet the address referes to
Creates an Address object
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
The Excel Address
Reference to the package to find information about tables and names
The address
Returns the parts of this address that not intersects with
The address to intersect with
The addresses not intersecting with
Address is an defined name
the name
Should always be true
Sets the address
The address
Method for actions that must be taken before address is changed
Called when the address changes
Gets the row and column of the top left cell.
The start row column.
Gets the row and column of the bottom right cell.
The end row column.
The index to the external reference. Return 0, the current workbook, if no reference exists.
If the address is refering a table, this property contains additional information
The address for the range
The $absolute$ address
The full address including the worksheet
If the address is a defined name
Returns the address text
Serves as the default hash function.
A hash code for the current object.
returns the first address if the address is a multi address.
A1:A2,B1:B2 returns A1:A2
Returns the address of the first cell in the address without $. Returns #REF! if the address is invalid.
Validate the address
Number of rows int the address
Number of columns int the address
Returns true if the range spans a full row
Returns true if the range spans a full column
The address without the workbook or worksheet reference
The address without the workbook reference
Returns true if the item is equal to another item.
The item to compare
True if the items are equal
Returns true the address contains an external reference
An image that fills the background of the worksheet.
The topnode of the worksheet
Worksheet reference
The background image of the worksheet.
Note that images of type .svg, .ico and .webp is not supported as background images.
Set the picture from an image file.
The image file. Files of type .svg, .ico and .webp is not supported for background images
Set the picture from an image file.
The path to the image file. Files of type .svg, .ico and .webp is not supported for background images
Removes the background image.
A single cell address
Initializes a new instance of the ExcelCellAddress class.
Initializes a new instance of the ExcelCellAddress class.
The row.
The column.
If the row is fixed, prefixed with $
If the column is fixed, prefixed with $
Initializes a new instance of the ExcelCellAddress class.
The address
Row
Column
Celladdress
Returns true if the row is fixed
Returns true if the column is fixed
If the address is an invalid reference (#REF!)
Returns the letter corresponding to the supplied 1-based column index.
Index of the column (1-based)
The corresponding letter, like A for 1.
Base class containing cell address manipulating methods.
Get the sheet, row and column from the CellID
Get the cellID for the cell.
Translates a R1C1 to an absolut address/Formula
Address
Current row
Current column
The RC address
Translates a absolut address to R1C1 Format
R1C1 Address
Current row
Current column
The absolut address/Formula
Returns the character representation of the numbered column
The number of the column
The letter representing the column
Returns the character representation of the numbered column
The number of the column
True for fixed column
The letter representing the column
Get the row/columns for a Cell-address
The address
Returns the to column
Returns the from column
Returns the to row
Returns the from row
Is the from row fixed?
Is the from column fixed?
Is the to row fixed?
Is the to column fixed?
A reference to the workbook object
The worksheet name used for addresses without a worksheet reference.
Get the row/column for n Cell-address
The address
Returns Tthe row
Returns the column
true if valid
Get the row/column for a Cell-address
the address
returns the row
returns the column
throw exception if invalid, otherwise returns false
Get the row number in text
The row
If the row is absolute. Adds a $ before the address if true
Get the columnn address for the column
The column
If the column is absolute. Adds a $ before the address if true
Returns the AlphaNumeric representation that Excel expects for a Cell Address
The number of the row
The number of the column in the worksheet
The cell address in the format A1
Returns the AlphaNumeric representation that Excel expects for a Cell Address
The number of the row
The number of the column in the worksheet
Absolute row
Absolute column
The cell address in the format A1
Returns the AlphaNumeric representation that Excel expects for a Cell Address
The number of the row
The number of the column in the worksheet
Get an absolute address ($A$1)
The cell address in the format A1
Returns the AlphaNumeric representation that Excel expects for a Cell Address
From row number
From column number
To row number
From column number
The cell address in the format A1
Returns the AlphaNumeric representation that Excel expects for a Cell Address
From row number
From column number
To row number
From column number
if true address is absolute (like $A$1)
The cell address in the format A1
Returns the AlphaNumeric representation that Excel expects for a Cell Address
From row number
From column number
To row number
From column number
The cell address in the format A1
Get the full address including the worksheet name
The name of the worksheet
The address
The full address
Get the full address including the worksheet name
The workbook, if other than current
The name of the worksheet
The address
The full address
If the address is a address is a cell or range address of format A1 or A1:A2, without specified worksheet name.
the address
True if valid.
Returns true if the range or table address is valid
The address to check
Return true if the address is valid
Returns true if the address is a valid table address. I.e table1[], table1[[#this row],[column1]]
Returns true if the range is valid
The address to check
Return true if the address is valid
Checks that a cell address (e.g. A5) is valid.
The alphanumeric cell address
True if the cell address is valid
Updates the Excel formula so that all the cellAddresses are incremented by the row and column increments
if they fall after the afterRow and afterColumn.
Supports inserting rows and columns into existing templates.
The Excel formula
The amount to increment the cell reference by
The amount to increment the cell reference by
Only change rows after this row
Only change columns after this column
The sheet that contains the formula currently being processed.
The sheet where cells are being inserted or deleted.
Fixed address
If a copy operation is performed, fully fixed cells should be untoughe.
Tokens, if a cache exists
The updated version of the .
Updates the Excel formula so that all the cellAddresses are incremented by the row and column increments
if they fall after the afterRow and afterColumn.
Supports inserting rows and columns into existing templates.
The Excel formula
The range that is inserted
The range effected by the insert
Shift operation
The sheet that contains the formula currently being processed.
The sheet where cells are being inserted or deleted.
Fixed address
The updated version of the .
Updates all formulas after a worksheet has been renamed
The formula to be updated.
The old sheet name.
The new sheet name.
The formula to be updated.
Represents an Excel Chartsheet and provides access to its properties and methods
The worksheet chart object
Represents one or more columns within the worksheet
Creates a new instance of the ExcelColumn class.
For internal use only!
Sets the first column the definition refers to.
Sets the last column the definition refers to.
Internal range id for the column
Allows the column to be hidden in the worksheet
Defines if the column is visible or hidden
Sets the width of the column in the worksheet
If set to true a column automaticlly resize(grow wider) when a user inputs numbers in a cell.
If the column is collapsed in outline mode.
Setting this property will not hide the children.
Use the or methods to collapse and hide columns/rows via the collection.
Outline level. Zero if no outline
Phonetic
The Style applied to the whole column. Only effects cells with no individual style set.
Use Range object if you want to set specific styles.
Sets the style for the entire column using a style name.
Sets the style for the entire column using the style ID.
Adds a manual page break after the column.
Merges all cells of the column
Returns the range of columns covered by the column definition.
A string describing the range of columns covered by the column definition.
Set the column width from the content of the range. The minimum width is the value of the ExcelWorksheet.defaultColumnWidth property.
Note: Cells containing formulas are ignored unless a calculation is performed.
Wrapped and merged cells are also ignored.
Set the column width from the content.
Note: Cells containing formulas are ignored unless a calculation is performed.
Wrapped and merged cells are also ignored.
Minimum column width
Set the column width from the content.
Note: Cells containing formulas are ignored unless a calculation is performed.
Wrapped and merged cells are also ignored.
Minimum column width
Maximum column width
Get the internal RangeID
Sheet no
Column
Copies the current column to a new worksheet
The worksheet where the copy will be created
A collection of columns in a worksheet
Indexer referenced by column index
The column index
The column
Indexer referenced by from and to column index
Column from index
Column to index
An Excel Cell Comment
The author
The comment text
Sets the font of the first richtext item.
Richtext collection
Reference
Collection of Excel Comment objects
Access to the comment xml document
A reference to the worksheet object
Number of comments in the collection
Indexer for the comments collection
The index
The comment
Indexer for the comments collection
The cell
The comment
Indexer for the comments collection
The cell address
The comment
Adds a comment to the top left cell of the range
The cell
The comment text
The author for the comment. If this property is null or blank EPPlus will set it to the identity of the ClaimsPrincipal if available otherwise to "Anonymous"
The comment
Removes the comment
The comment to remove
Shifts all comments based on their address and the location of inserted rows and columns.
The start row.
The start column.
The number of rows to insert.
The number of columns to insert.
If the delete is in a range, this is the end row
If the delete is in a range, this the end column
Shifts all comments based on their address and the location of inserted rows and columns.
The start row
The start column
The number of rows to insert
The number of columns to insert
If the insert is in a range, this is the end row
If the insert is in a range, this the end column
Removes the comment at the specified position
The index
Reads an environment variable from the o/s. If an error occors it will rethrow the unless SuppressInitializationExceptions of the is set to true.
The key of the requested variable
The
Configuration of the package
A list of logged objects.
The value of the environment variable
Encryption Algorithm
128-bit AES. Default
192-bit AES.
256-bit AES.
The major version of the Encryption
Standard Encryption.
Used in Excel 2007 and previous version with compatibility pack.
Default AES 128 with SHA-1 as the hash algorithm. Spincount is hardcoded to 50000
Agile Encryption.
Used in Excel 2010-
Default.
How and if the workbook is encrypted
Constructor
Default AES 256 with SHA-512 as the hash algorithm. Spincount is set to 100000
Constructor
Algorithm used to encrypt the package. Default is AES128
Is the package encrypted
The password used to encrypt the workbook.
Algorithm used for encrypting the package. Default is AES 128-bit for standard and AES 256 for agile
The version of the encryption.
Encrypts a stream using the office encryption.
The stream containing the non-encrypted package.
The password to encrypt with
The encryption version
The algorithm to use for the encryption
A MemoryStream containing the encypted package
Decrypts a stream using the office encryption.
The stream containing the encrypted package.
The password to decrypt with
A memorystream with the encypted package
File sharing settings for the workbook.
Writes protectes the workbook with a password.
EPPlus uses SHA-512 as hash algorithm with a spin count of 100000.
The name of the person enforcing the write protection
The password. Setting the password to null or empty will remove the read-only mode.
Remove any write protection set on the workbook
If the workbook is set to readonly and has a password set.
The name of the person enforcing the write protection.
If the author recommends that you open the workbook in read-only mode.
Range address used in the formula parser
Creates a Address object
Creates an Address object
start row
start column
End row
End column
Creates an Address object
The formula address
The worksheet
The address for the range
Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5"
Addresses can be separated by a comma. If the address contains multiple addresses this list contains them.
How a picture will be aligned in the header/footer
The picture will be added to the left aligned text
The picture will be added to the centered text
The picture will be added to the right aligned text
Print header and footer
Get/set the text to appear on the left hand side of the header (or footer) on the worksheet.
Get/set the text to appear in the center of the header (or footer) on the worksheet.
Get/set the text to appear on the right hand side of the header (or footer) on the worksheet.
Inserts a picture at the end of the text in the header or footer
The image object containing the Picture
Alignment. The image object will be inserted at the end of the Text.
Inserts a picture at the end of the text in the header or footer
The stream containing the picture
The image format of the picture stream
Alignment. The image object will be inserted at the end of the Text.
Represents the Header and Footer on an Excel Worksheet
The code for "current page #"
The code for "total pages"
The code for "text font color"
RGB Color is specified as RRGGBB
Theme Color is specified as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade value, NN is the tint/shade value.
The code for "sheet tab name"
The code for "this workbook's file path"
The code for "this workbook's file name"
The code for "date"
The code for "time"
The code for "picture as background"
The code for "outline style"
The code for "shadow style"
ExcelHeaderFooter Constructor
The worksheet
Align with page margins
Displas different headers and footers on odd and even pages.
Display different headers and footers on the first page of the worksheet.
The header and footer should scale as you use the ShrinkToFit property on the document
Provides access to the header on odd numbered pages of the document.
If you want the same header on both odd and even pages, then only set values in this ExcelHeaderFooterText class.
Provides access to the footer on odd numbered pages of the document.
If you want the same footer on both odd and even pages, then only set values in this ExcelHeaderFooterText class.
Provides access to the header on even numbered pages of the document.
Provides access to the footer on even numbered pages of the document.
Provides access to the header on the first page of the document.
Provides access to the footer on the first page of the document.
Vml drawings. Underlaying object for Header footer images
Saves the header and footer information to the worksheet XML
HyperlinkClass
A new hyperlink with the specified URI
The URI
A new hyperlink with the specified URI and kind
The URI
Kind (absolute/relative or indeterminate)
Sheet internal reference
The address or defined name
Displayed text
The Excel address for internal links or extended data for external hyper links not supported by the Uri class.
Displayed text
Tooltip
If the hyperlink spans multiple columns
If the hyperlink spans multiple rows
Used to handle non absolute URI's.
Is used if IsAblsoluteUri is true. The base URI will have a dummy value of xl://nonAbsolute.
Error ignore options for a worksheet
Ignore errors when numbers are formatted as text or are preceded by an apostrophe
Calculated Column
Ignore errors when a formula refers an empty cell
Ignore errors when formulas fail to Evaluate
Ignore errors when a formula in a region of your worksheet differs from other formulas in the same region.
Ignore errors when formulas omit certain cells in a region.
Ignore errors when a cell's value in a Table does not comply with the Data Validation rules specified
The address
Ignore errors when formulas contain text formatted cells with years represented as 2 digits.
Ignore errors when unlocked cells contain formulas
A collection of ignored errors per range for a worksheet
Indexer for the collection
This index
Number of items in the collection
Gets the enumerator for the collection
The enumerator
Adds an IgnoreError item to the collection
The address to add
The IgnoreError Item
Gets the enumerator for the collection
The enumerator
Called when the class is disposed.
This class contains settings for text measurement.
This is the primary handler for images.
If the primary handler fails to measure the image, this one will be used.
If the secondary handler fails to measure the image, this one will be used.
This class represents an error/Exception that has occured during initalization.
Constructor
Error message describing the initialization error
Timestamp representing when the error occurred
The
A named range.
The name contains a relative address
The name contains a relative table address, i.e. [#this row]
A named range
The name
The sheet containing the name. null if its a global name
Sheet where the address points
The address
The index in the collection
If true, the address will be retained as it is, if false the address will always be converted to an absolute/fixed address
Name of the range
Is the named range local for the sheet
Is the name hidden
A comment for the Name
Returns a string representation of the object
The name of the range
Returns true if the name is equal to the obj
The object to compare with
true if equal
If true, the address will be retained as it is, if false the address will always be converted to an absolute/fixed address
Serves as the default hash function.
A hash code for the current object.
Collection for named ranges
Adds a new named range
The name
The range
If true, the address will be retained as it is, if false the address will always be converted to an absolute/fixed address
Adds a new named range
The name
The range
Adds the name without validation as Excel allows some names on load that is not permitted in the GUI
The Name
The Range
If true, the address will be retained as it is, if false the address will always be converted to an absolute/fixed address
Add a defined name referencing value
The name
The value for the name
Add a defined name referencing a formula
Remove a defined name from the collection
The name
Checks collection for the presence of a key
key to search for
true if the key is in the collection
The current number of items in the collection
Name indexer
The name (key) for a Named range
a reference to the range
Throws a KeyNotFoundException if the key is not in the collection.
Indexer for the collection
The index
The named range
Implement interface method IEnumerator<ExcelNamedRange> GetEnumerator()
Implement interface method IEnumeratable GetEnumerator()
Represents an Excel XLSX file package.
This is the top-level object to access all parts of the document.
FileInfo newFile = new FileInfo(outputDir.FullName + @"\sample1.xlsx");
if (newFile.Exists)
{
newFile.Delete(); // ensures we create a new workbook
newFile = new FileInfo(outputDir.FullName + @"\sample1.xlsx");
}
using (ExcelPackage package = new ExcelPackage(newFile))
{
// add a new worksheet to the empty workbook
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Inventory");
//Add the headers
worksheet.Cells[1, 1].Value = "ID";
worksheet.Cells[1, 2].Value = "Product";
worksheet.Cells[1, 3].Value = "Quantity";
worksheet.Cells[1, 4].Value = "Price";
worksheet.Cells[1, 5].Value = "Value";
//Add some items...
worksheet.Cells["A2"].Value = "12001";
worksheet.Cells["B2"].Value = "Nails";
worksheet.Cells["C2"].Value = 37;
worksheet.Cells["D2"].Value = 3.99;
worksheet.Cells["A3"].Value = "12002";
worksheet.Cells["B3"].Value = "Hammer";
worksheet.Cells["C3"].Value = 5;
worksheet.Cells["D3"].Value = 12.10;
worksheet.Cells["A4"].Value = "12003";
worksheet.Cells["B4"].Value = "Saw";
worksheet.Cells["C4"].Value = 12;
worksheet.Cells["D4"].Value = 15.37;
//Add a formula for the value-column
worksheet.Cells["E2:E4"].Formula = "C2*D2";
//Ok now format the values;
using (var range = worksheet.Cells[1, 1, 1, 5])
{
range.Style.Font.Bold = true;
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.DarkBlue);
range.Style.Font.Color.SetColor(Color.White);
}
worksheet.Cells["A5:E5"].Style.Border.Top.Style = ExcelBorderStyle.Thin;
worksheet.Cells["A5:E5"].Style.Font.Bold = true;
worksheet.Cells[5, 3, 5, 5].Formula = string.Format("SUBTOTAL(9,{0})", new ExcelAddress(2,3,4,3).Address);
worksheet.Cells["C2:C5"].Style.Numberformat.Format = "#,##0";
worksheet.Cells["D2:E5"].Style.Numberformat.Format = "#,##0.00";
//Create an autofilter for the range
worksheet.Cells["A1:E4"].AutoFilter = true;
worksheet.Cells["A1:E5"].AutoFitColumns(0);
// lets set the header text
worksheet.HeaderFooter.oddHeader.CenteredText = "&24&U&\"Arial,Regular Bold\" Inventory";
// add the page number to the footer plus the total number of pages
worksheet.HeaderFooter.oddFooter.RightAlignedText =
string.Format("Page {0} of {1}", ExcelHeaderFooter.PageNumber, ExcelHeaderFooter.NumberOfPages);
// add the sheet name to the footer
worksheet.HeaderFooter.oddFooter.CenteredText = ExcelHeaderFooter.SheetName;
// add the file path to the footer
worksheet.HeaderFooter.oddFooter.LeftAlignedText = ExcelHeaderFooter.FilePath + ExcelHeaderFooter.FileName;
worksheet.PrinterSettings.RepeatRows = worksheet.Cells["1:2"];
worksheet.PrinterSettings.RepeatColumns = worksheet.Cells["A:G"];
// Change the sheet view to show it in page layout mode
worksheet.View.PageLayoutView = true;
// set some document properties
package.Workbook.Properties.Title = "Invertory";
package.Workbook.Properties.Author = "Jan Källman";
package.Workbook.Properties.Comments = "This sample demonstrates how to create an Excel 2007 workbook using EPPlus";
// set some extended property values
package.Workbook.Properties.Company = "AdventureWorks Inc.";
// set some custom property values
package.Workbook.Properties.SetCustomPropertyValue("Checked by", "Jan Källman");
package.Workbook.Properties.SetCustomPropertyValue("AssemblyName", "EPPlus");
// save our new workbook and we are done!
package.Save();
}
return newFile.FullName;
More samples can be found at https://github.com/EPPlusSoftware/EPPlus/
Extension Schema types
Main Xml schema name
Relationship schema name
Maximum number of columns in a worksheet (16384).
Maximum number of rows in a worksheet (1048576).
Create a new instance of the ExcelPackage.
Output is accessed through the Stream property, using the method or later set the property.
Create a new instance of the ExcelPackage class based on a existing file or creates a new file.
If newFile exists, it is opened. Otherwise it is created from scratch.
Create a new instance of the ExcelPackage class based on a existing file or creates a new file.
If newFile exists, it is opened. Otherwise it is created from scratch.
Create a new instance of the ExcelPackage class based on a existing file or creates a new file.
If newFile exists, it is opened. Otherwise it is created from scratch.
Password for an encrypted package
Create a new instance of the ExcelPackage class based on a existing file or creates a new file.
If newFile exists, it is opened. Otherwise it is created from scratch.
Password for an encrypted package
Create a new instance of the ExcelPackage class based on a existing template.
If newFile exists, it will be overwritten when the Save method is called
The name of the Excel file to be created
The name of the Excel template to use as the basis of the new Excel file
Create a new instance of the ExcelPackage class based on a existing template.
If newFile exists, it will be overwritten when the Save method is called
The name of the Excel file to be created
The name of the Excel template to use as the basis of the new Excel file
Password to decrypted the template
Create a new instance of the ExcelPackage class based on a existing template.
If newFile exists, it will be overwritten when the Save method is called
The name of the Excel file to be created
The name of the Excel template to use as the basis of the new Excel file
Password to decrypted the template
Create a new instance of the ExcelPackage class based on a existing template.
The name of the Excel template to use as the basis of the new Excel file
if true use a stream. If false create a file in the temp dir with a random name
Create a new instance of the ExcelPackage class based on a existing template.
The name of the Excel template to use as the basis of the new Excel file
if true use a stream. If false create a file in the temp dir with a random name
Password to decrypted the template
Create a new instance of the ExcelPackage class based on a stream
The stream object can be empty or contain a package. The stream must be Read/Write
Create a new instance of the ExcelPackage class based on a stream
The stream object can be empty or contain a package. The stream must be Read/Write
The password to decrypt the document
Create a new instance of the ExcelPackage class based on a stream
The output stream. Must be an empty read/write stream.
This stream is copied to the output stream at load
Create a new instance of the ExcelPackage class based on a stream
The output stream. Must be an empty read/write stream.
This stream is copied to the output stream at load
Password to decrypted the template
Init values here
Create a new file from a template
An existing xlsx file to use as a template
The password to decrypt the package.
Pull request from perkuypers to read open Excel workbooks
Path
Stream
Returns a reference to the package
Information how and if the package is encrypted
To use the EPPlus library in debug mode a Licensetype must be specified.
Use LicenseContext.NonCommercial if you use EPPlus in an non commercial context.
Use LicenseContext.Commercial if you have purchased an license to use EPPlus
See https://epplussoftware.com/developers/licenseexception
Returns a reference to the workbook component within the package.
All worksheets and cells can be accessed through the workbook.
Global configuration for the ExcelPackage class
Errors that has been logged during initialization of the ExcelPackage class.
Automaticlly adjust drawing size when column width/row height are adjusted, depending on the drawings editBy property.
Default True
Saves the XmlDocument into the package at the specified Uri.
The Uri of the component
The XmlDocument to save
Saves the XmlDocument into the package at the specified Uri.
The Uri of the component
The XmlDocument to save
Closes the package.
Saves all the components back into the package.
This method recursively calls the Save method on all sub-components.
We close the package after the save is done.
Saves all the components back into the package.
This method recursively calls the Save method on all sub-components.
The package is closed after it has ben saved
Supply a password to encrypt the workbook with.
This parameter overrides the Workbook.Encryption.Password.
Saves the workbook to a new file
The package is closed after it has been saved
The file location
Saves the workbook to a new file
The package is closed after it has been saved
The file location
Saves the workbook to a new file
The package is closed after it has been saved
The file
The password to encrypt the workbook with.
This parameter overrides the Encryption.Password.
Saves the workbook to a new file
The package is closed after it has been saved
The file
The password to encrypt the workbook with.
This parameter overrides the Encryption.Password.
Copies the Package to the Outstream
The package is closed after it has been saved
The stream to copy the package to
Copies the Package to the Outstream
The package is closed after it has been saved
The stream to copy the package to
The password to encrypt the workbook with.
This parameter overrides the Encryption.Password.
The output file. Null if no file is used
Close the internal stream
The output stream. This stream is the not the encrypted package.
To get the encrypted package use the SaveAs(stream) method.
Compression option for the package
Compatibility settings for older versions of EPPlus.
Package generic settings
Memmory settings for RecyclableMemoryStream handling
Get the XmlDocument from an URI
The Uri to the part
The XmlDocument
Saves and returns the Excel files as a bytearray.
Note that the package is closed upon save
Example how to return a document from a Webserver...
ExcelPackage package=new ExcelPackage();
/**** ... Create the document ****/
Byte[] bin = package.GetAsByteArray();
Response.ContentType = "Application/vnd.ms-Excel";
Response.AddHeader("content-disposition", "attachment; filename=TheFile.xlsx");
Response.BinaryWrite(bin);
Saves and returns the Excel files as a bytearray
Note that the package is closed upon save
Example how to return a document from a Webserver...
ExcelPackage package=new ExcelPackage();
/**** ... Create the document ****/
Byte[] bin = package.GetAsByteArray();
Response.ContentType = "Application/vnd.ms-Excel";
Response.AddHeader("content-disposition", "attachment; filename=TheFile.xlsx");
Response.BinaryWrite(bin);
The password to encrypt the workbook with.
This parameter overrides the Encryption.Password.
Loads the specified package data from a stream.
The input.
Loads the specified package data from a stream.
The input.
The password to decrypt the document
Loads the specified package data from a stream.
The input file.
The cancellation token
Loads the specified package data from a stream.
The input file.
The cancellation token
Loads the specified package data from a stream.
The input file.
The password
The cancellation token
Loads the specified package data from a stream.
The input file.
The password
The cancellation token
Loads the specified package data from a stream.
The input file.
The out stream. Sets the Stream property
The password
The cancellation token
Loads the specified package data from a stream.
The input file.
The out stream. Sets the Stream property
The password
The cancellation token
Loads the specified package data from a stream.
The input.
The cancellation token
Loads the specified package data from a stream.
The input.
The password to decrypt the document
The cancellation token
Saves all the components back into the package.
This method recursively calls the Save method on all sub-components.
The package is closed after it has ben saved
d to encrypt the workbook with.
Saves all the components back into the package.
This method recursively calls the Save method on all sub-components.
The package is closed after it has ben saved
Supply a password to encrypt the workbook package.
This parameter overrides the Workbook.Encryption.Password.
The cancellation token
Saves the workbook to a new file
The package is closed after it has been saved
The file location
The cancellation token
Saves the workbook to a new file
The package is closed after it has been saved
The file location
The cancellation token
Saves the workbook to a new file
The package is closed after it has been saved
The file
The password to encrypt the workbook with.
This parameter overrides the Encryption.Password.
The cancellation token
Saves the workbook to a new file
The package is closed after it has been saved
The file
The password to encrypt the workbook with.
This parameter overrides the Encryption.Password.
The cancellation token
Copies the Package to the Outstream
The package is closed after it has been saved
The stream to copy the package to
The cancellation token
Copies the Package to the Outstream
The package is closed after it has been saved
The stream to copy the package to
The password to encrypt the workbook with.
This parameter overrides the Encryption.Password.
The cancellation token
Saves and returns the Excel files as a bytearray.
Note that the package is closed upon save
Example how to return a document from a Webserver...
ExcelPackage package=new ExcelPackage();
/**** ... Create the document ****/
Byte[] bin = package.GetAsByteArray();
Response.ContentType = "Application/vnd.ms-Excel";
Response.AddHeader("content-disposition", "attachment; filename=TheFile.xlsx");
Response.BinaryWrite(bin);
The cancellation token
Saves and returns the Excel files as a bytearray
Note that the package is closed upon save
Example how to return a document from a Webserver...
ExcelPackage package=new ExcelPackage();
/**** ... Create the document ****/
Byte[] bin = package.GetAsByteArray();
Response.ContentType = "Application/vnd.ms-Excel";
Response.AddHeader("content-disposition", "attachment; filename=TheFile.xlsx");
Response.BinaryWrite(bin);
The password to encrypt the workbook with.
This parameter overrides the Encryption.Password.
The cancellation token
Package generic settings
Culture specific number formats for the build-in number formats ranging from 14-47.
As some build-in number formats are culture specific, this collection adds the pi
Do not call garbage collection when ExcelPackage is disposed.
Manage text settings such as measurement of text for the Autofit functions.
Set the handler for getting image bounds.
Any auto- or table- filters created will be applied on save.
In the case you want to handle this manually, set this property to false.
Printer orientation
Portrait orientation
Landscape orientation
Papersize
Letter paper (8.5 in. by 11 in.)
Letter small paper (8.5 in. by 11 in.)
// Tabloid paper (11 in. by 17 in.)
Ledger paper (17 in. by 11 in.)
Legal paper (8.5 in. by 14 in.)
Statement paper (5.5 in. by 8.5 in.)
Executive paper (7.25 in. by 10.5 in.)
A3 paper (297 mm by 420 mm)
A4 paper (210 mm by 297 mm)
A4 small paper (210 mm by 297 mm)
A5 paper (148 mm by 210 mm)
B4 paper (250 mm by 353 mm)
B5 paper (176 mm by 250 mm)
Folio paper (8.5 in. by 13 in.)
Quarto paper (215 mm by 275 mm)
Standard paper (10 in. by 14 in.)
Standard paper (11 in. by 17 in.)
Note paper (8.5 in. by 11 in.)
#9 envelope (3.875 in. by 8.875 in.)
#10 envelope (4.125 in. by 9.5 in.)
#11 envelope (4.5 in. by 10.375 in.)
#12 envelope (4.75 in. by 11 in.)
#14 envelope (5 in. by 11.5 in.)
C paper (17 in. by 22 in.)
D paper (22 in. by 34 in.)
E paper (34 in. by 44 in.)
DL envelope (110 mm by 220 mm)
C5 envelope (162 mm by 229 mm)
C3 envelope (324 mm by 458 mm)
C4 envelope (229 mm by 324 mm)
C6 envelope (114 mm by 162 mm)
C65 envelope (114 mm by 229 mm)
B4 envelope (250 mm by 353 mm)
B5 envelope (176 mm by 250 mm)
B6 envelope (176 mm by 125 mm)
Italy envelope (110 mm by 230 mm)
Monarch envelope (3.875 in. by 7.5 in.).
6 3/4 envelope (3.625 in. by 6.5 in.)
US standard fanfold (14.875 in. by 11 in.)
German standard fanfold (8.5 in. by 12 in.)
German legal fanfold (8.5 in. by 13 in.)
ISO B4 (250 mm by 353 mm)
Japanese double postcard (200 mm by 148 mm)
Standard paper (9 in. by 11 in.)
Standard paper (10 in. by 11 in.)
Standard paper (15 in. by 11 in.)
Invite envelope (220 mm by 220 mm)
Letter extra paper (9.275 in. by 12 in.)
Legal extra paper (9.275 in. by 15 in.)
Tabloid extra paper (11.69 in. by 18 in.)
A4 extra paper (236 mm by 322 mm)
Letter transverse paper (8.275 in. by 11 in.)
A4 transverse paper (210 mm by 297 mm)
Letter extra transverse paper (9.275 in. by 12 in.)
SuperA/SuperA/A4 paper (227 mm by 356 mm)
SuperB/SuperB/A3 paper (305 mm by 487 mm)
Letter plus paper (8.5 in. by 12.69 in.)
A4 plus paper (210 mm by 330 mm)
A5 transverse paper (148 mm by 210 mm)
JIS B5 transverse paper (182 mm by 257 mm)
A3 extra paper (322 mm by 445 mm)
A5 extra paper (174 mm by 235 mm)
ISO B5 extra paper (201 mm by 276 mm)
A2 paper (420 mm by 594 mm)
A3 transverse paper (297 mm by 420 mm)
A3 extra transverse paper (322 mm by 445 mm*/
Specifies printed page order
Order pages vertically first, then move horizontally.
Order pages horizontally first, then move vertically
Printer settings
Left margin in inches
Right margin in inches
Top margin in inches
Bottom margin in inches
Header margin in inches
Footer margin in inches
Orientation
Portrait or Landscape
Fit to Width in pages.
Set FitToPage to true when using this one.
0 is automatic
Fit to height in pages.
Set FitToPage to true when using this one.
0 is automatic
Print scale
Fit To Page.
Print headings (column letter and row numbers)
Print titles
Rows to be repeated after each pagebreak.
The address must be a full row address (ex. 1:1)
Print titles
Columns to be repeated after each pagebreak.
The address must be a full column address (ex. A:A)
The printarea.
Null if no print area is set.
Print gridlines
Horizontal centered when printing
w
Vertical centered when printing
Specifies printed page order
Print black and white
Print a draft
Paper size
All or none of the margin attributes must exist. Create all att ones.
A protected range in a worksheet
The name of the protected range
The address of the protected range
Sets the password for the range
The password used to generete the hash
The security descriptor defines user accounts who may edit this range without providing a password to access the range.
A collection of protected ranges in the worksheet.
Adds a new protected range
The name of the protected range
The address within the worksheet
Clears all protected ranges
Checks if the collection contains a specific item.
Copies the entire collection to a compatible one-dimensional
array, starting at the specified index of the target array.
The array
The index
Numner of items in the collection
Remove the specified item from the collection
The item
Get the index in the collection of the supplied item
The item
Remove the item at the specified indexx
Indexer for the collection
The index to return
Get the enumerator
The enumerator
Get the enumerator
The enumerator
Sets protection on the workbook level
Sets a password for the workbook. This does not encrypt the workbook.
The password.
Locks the structure,which prevents users from adding or deleting worksheets or from displaying hidden worksheets.
Locks the position of the workbook window.
Lock the workbook for revision
File sharing settings for the workbook.
A range of cells.
Access the range using an address
The address
A range object
Access a single cell
The row
The column
A range object
Access a range of cells
Start row
Start column
End Row
End Column
Set the formula for the range.
The formula for the range.
If the formula should be created as a shared formula. If false each cell will be set individually. This can be useful if the formula returns a dynamic array result.
A range of cells
Reference to the worksheet
On change address handler
We dont know the address yet. Set the delegate first time a property is set.
Set a single cell
Set a range
Set a multirange (A1:A2,C1:C2)
Set the property for an address
Handles shared formulas
The range
The formula
The address of the formula
If the forumla is an array formula.
If the array formula is dynamic
The style object for the range.
The named style
The style ID.
It is not recomended to use this one. Use Named styles as an alternative.
If you do, make sure that you use the Style.UpdateXml() method to update any new styles added to the workbook.
Set the range to a specific value
Sets the range to an Error value
The type of error
Returns the formatted value.
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored.
The minimum width is the value of the ExcelWorksheet.defaultColumnWidth property.
Cells containing formulas must be calculated before autofit is called.
Wrapped and merged cells are also ignored.
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored.
This method will not work if you run in an environment that does not support GDI.
Cells containing formulas are ignored if no calculation is made.
Wrapped and merged cells are also ignored.
Minimum column width
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored.
This method will not work if you run in an environment that does not support GDI.
Cells containing formulas are ignored if no calculation is made.
Wrapped and merged cells are also ignored.
Minimum column width
Maximum column width
Gets or sets a formula for a range.
Gets or Set a formula in R1C1 format.
Creates an for html export of this range.
A html exporter
Set the Hyperlink property for a range of cells
Sets the hyperlink property
The URI to set
Sets the Hyperlink property using the ExcelHyperLink class.
The uri to set
Sets the Hyperlink property to an url within the workbook.
A reference within the same workbook
The displayed text in the cell. If display is null or empty, the address of the range will be set.f
Sets the Hyperlink property to an url within the workbook. The hyperlink will display the value of the cell.
A reference within the same workbook
If the cells in the range are merged.
Set an autofilter for the range
If the value is in richtext format.
Returns true if the range is a table. If the range partly matches a table range false will be returned.
Returns the if the range is a table.
If the range doesn't or partly matches a table range, null is returned.
Insert cells into the worksheet and shift the cells to the selected direction.
The direction that the cells will shift.
Delete the range from the worksheet and shift affected cells in the selected direction.
The direction that the cells will shift.
Is the range a part of an Arrayformula
The richtext collection
The cell value is rich text formatted.
The RichText-property only apply to the left-top cell of the range.
Returns the comment object of the first cell in the range
Returns the threaded comment object of the first cell in the range
WorkSheet object
Address including sheet name
Address including sheetname
Set the value without altering the richtext property
the value
Removes all formulas within the range, but keeps the calculated values.
Removes all values of cells with formulas, but keeps the formulas.
Conditional Formatting for this range.
Data validation for this range.
Convert cell value to desired type, including nullable structs.
When converting blank string to nullable struct (e.g. ' ' to int?) null is returned.
When attempted conversion fails exception is passed through.
The type to convert to.
The converted to .
If is string, parsing is performed for output types of DateTime and TimeSpan, which if fails throws .
Another special case for output types of DateTime and TimeSpan is when input is double, in which case
is used for conversion. This special case does not work through other types convertible to double (e.g. integer or string with number).
In all other cases 'direct' conversion is performed.
is string and its format is invalid for conversion (parsing fails)
is not string and direct conversion fails
Get a range with an offset from the top left cell.
The new range has the same dimensions as the current range
Row Offset
Column Offset
Get a range with an offset from the top left cell.
Row Offset
Column Offset
Number of rows. Minimum 1
Number of colums. Minimum 1
Adds a new comment for the range.
If this range contains more than one cell, the top left comment is returned by the method.
The text for the comment
The author for the comment. If this property is null or blank EPPlus will set it to the identity of the ClaimsPrincipal if available otherwise to "Anonymous"
A reference comment of the top left cell
Adds a new threaded comment for the range.
If this range contains more than one cell, the top left comment is returned by the method.
A reference comment of the top left cell
Copies the range of cells to another range.
The top-left cell where the range will be copied.
Copies the range of cells to an other range
The start cell where the range will be copied.
Cell properties that will not be copied.
Copies the range of cells to an other range
The start cell where the range will be copied.
Cell properties that will not be copied.
Copy the styles from the source range to the destination range.
If the destination range is larger than the source range, the styles of the column to the right and the row at the bottom will be expanded to the destination.
The destination range
Clear all cells
Creates an array-formula.
The formula
If the array formula is dynamic.
Setting this argument to true will only add the dynamic array formula cell meta data flag to the formula.
If you calculate the formula it is not be necessary to set this flag. If you set this flag, you are responsible to set the correct range for the dynamic array formula, so in most cases calculating is a better approach.
If you calculate the formula this flag will be overwritten with the value the EPPlus decides for the formula.
Also see , ,
The output range of the formula in the top-left cell of the range.
A shared formula will return the range for the entire series.
An array formula will return the range of the output of the formula.
If you want the range of a dynamic array formula, you must calculate the formula first.
The range the formula
Clears either value or style for a range from the cellstore.
Disposes the object
Gets the enumerator for the collection
The enumerator
The current range when enumerating
The current range when enumerating
Iterate to the next cell
False if no more cells exists
Reset the enumerator
Sort the range by value of the first column, Ascending.
Sort the range by value of the supplied column, Ascending.
The column to sort by within the range. Zerobased
Descending if true, otherwise Ascending. Default Ascending. Zerobased
Sort the range by value
The column(s) to sort by within the range. Zerobased
Descending if true, otherwise Ascending. Default Ascending. Zerobased
The CultureInfo used to compare values. A null value means CurrentCulture
String compare option
Sort the range by value
The column(s) to sort by within the range. Zerobased
Descending if true, otherwise Ascending. Default Ascending. Zerobased
A Dictionary containing custom lists indexed by column
The CultureInfo used to compare values. A null value means CurrentCulture
String compare option
to be sorted
Indicates if the range should be sorted left to right (by column) instead of top-down (by row)
Sort the range by value
An instance of where sort parameters can be set
Sort the range by value. Supports top-down and left to right sort.
An action of where sort parameters can be set.
// 1. Sort rows (top-down)
// The Column function takes the zero based column index in the range
worksheet.Cells["A1:D15"].Sort(x => x.SortBy.Column(0).ThenSortBy.Column(1, eSortOrder.Descending));
// 2. Sort columns(left to right)
// The Row function takes the zero based row index in the range
worksheet.Cells["A1:D15"].Sort(x => x.SortLeftToRightBy.Row(0));
// 3. Sort using a custom list
worksheet.Cells["A1:D15"].Sort(x => x.SortBy.Column(0).UsingCustomList("S", "M", "L", "XL"));
worksheet.Cells["A1:D15"].Sort(x => x.SortLeftToRightBy.Row(0).UsingCustomList("S", "M", "L", "XL"));
Sort the range by value. Use RangeSortOptions.Create() to create an instance of the sort options, then
use the or properties to build up your sort parameters.
Options for the sort
var options = RangeSortOptions.Create();
var builder = options.SortBy.Column(0);
builder.ThenSortBy.Column(2).UsingCustomList("S", "M", "L", "XL");
builder.ThenSortBy.Column(3);
worksheet.Cells["A1:D15"].Sort(options);
If the range is a name or a table, return the name.
A reference to the column properties for column(s= referenced by this range.
If multiple ranges are addressed (e.g a1:a2,c1:c3), only the first address is used.
A reference to the row properties for row(s) referenced by this range.
If multiple ranges are addressed (e.g a1:a2,c1:c3), only the first address is used.
Gets the typed value of a cell
The returned type
The value of the cell
Gets the value of a cell using an offset from the top-left cell in the range.
The returned type
Column offset from the top-left cell in the range
Gets the value of a cell using an offset from the top-left cell in the range.
The returned type
Row offset from the top-left cell in the range
Column offset from the top-left cell in the range
Sets the value of a cell using an offset from the top-left cell in the range.
Row offset from the top-left cell in the range
Column offset from the top-left cell in the range
The value to set.
If the formula in the single cell returns an array, implicit intersection will be used instead of creating a dynamic array formula.
Please note that this property must be set after setting the formula, as default behaviour is to create a dynamic array formula.
Shared formulas will always use implicit intersection.
Fills the range by adding 1 to each cell starting from the value in the top left cell by column
Fills a range by adding the step value to the start Value. If is null the first value in the row/column is used.
Fill is done by column from top to bottom
The start value of the first cell. If this value is null the value of the first cell is used.
The value used for each step
Fills a range by using the argument options.
The option to configure the fill.
Fills the range by adding 1 day to each cell starting from the value in the top left cell by column.
Fills the range by adding 1 day to each cell per column starting from .
Fill the range with dates.
Options how to perform the fill
Fills the range columnwise using the values in the list.
Type used in the list.
The list to use.
Load the data from the datareader starting from the top left cell of the range
The datareader to loadfrom
Print the column caption property (if set) or the columnname property if not, on first row
The name of the table
The table style to apply to the data
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to loadfrom
Print the column caption property (if set) or the columnname property if not, on first row
The name of the table
The table style to apply to the data
Transpose the data
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to load from
Print the caption property (if set) or the columnname property if not, on first row
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to load from
Print the caption property (if set) or the columnname property if not, on first row
Must be true to transpose data
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to loadfrom
Print the column caption property (if set) or the columnname property if not, on first row
The name of the table
The table style to apply to the data
The cancellation token to use
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to loadfrom
Print the column caption property (if set) or the columnname property if not, on first row
The name of the table
The table style to apply to the data
The cancellation token to use
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to load from
Print the caption property (if set) or the columnname property if not, on first row
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to load from
Print the caption property (if set) or the columnname property if not, on first row
If the data should be transposed on read or not
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to load from
Print the caption property (if set) or the columnname property if not, on first row
The cancellation token to use
The filled range
Load the data from the datareader starting from the top left cell of the range
The datareader to load from
Print the caption property (if set) or the columnname property if not, on first row
The cancellation token to use
The filled range
Load the data from the datatable starting from the top left cell of the range
The datatable to load
Print the column caption property (if set) or the columnname property if not, on first row
The table style to apply to the data
The filled range
Load the data from the datatable starting from the top left cell of the range
The datatable to load
Print the column caption property (if set) or the columnname property if not, on first row
The table style to apply to the data
Transpose the loaded data
The filled range
Load the data from the datatable starting from the top left cell of the range
The datatable to load
Print the caption property (if set) or the columnname property if not, on first row
The filled range
Load the data from the datatable starting from the top left cell of the range
The datatable to load
The filled range
Load the data from the starting from the top left cell of the range
to provide parameters to the function
sheet.Cells["C1"].LoadFromDataTable(dataTable, c =>
{
c.PrintHeaders = true;
c.TableStyle = TableStyles.Dark1;
});
The filled range
Loads data from the collection of arrays of objects into the range, starting from
the top-left cell.
The data.
Loads data from the collection of arrays of objects into the range transposed, starting from
the top-left cell.
Load a collection into a the worksheet starting from the top left row of the range.
The datatype in the collection
The collection to load
The filled range
Load a collection of T into the worksheet starting from the top left row of the range.
Default option will load all public instance properties of T
The datatype in the collection
The collection to load
Print the property names on the first row. If the property is decorated with a or a that attribute will be used instead of the reflected member name.
The filled range
Load a collection of T into the worksheet starting from the top left row of the range.
Default option will load all public instance properties of T
The datatype in the collection
The collection to load
Print the property names on the first row. If the property is decorated with a or a that attribute will be used instead of the reflected member name.
Will create a table with this style. If set to TableStyles.None no table will be created
The filled range
Load a collection of T into the worksheet starting from the top left row of the range.
Default option will load all public instance properties of T
The datatype in the collection
The collection to load
Print the property names on the first row. If the property is decorated with a or a that attribute will be used instead of the reflected member name.
Will create a table with this style. If set to TableStyles.None no table will be created
Will load data transposed
The filled range
Load a collection into the worksheet starting from the top left row of the range.
The datatype in the collection
The collection to load
Print the property names on the first row. Any underscore in the property name will be converted to a space. If the property is decorated with a or a that attribute will be used instead of the reflected member name.
Will create a table with this style. If set to TableStyles.None no table will be created
Property flags to use
The properties to output. Must be of type T
The filled range
Load a collection into the worksheet starting from the top left row of the range.
The datatype in the collection
The collection to load
Print the property names on the first row. Any underscore in the property name will be converted to a space. If the property is decorated with a or a that attribute will be used instead of the reflected member name.
Will create a table with this style. If set to TableStyles.None no table will be created
Will insert data transposed
Property flags to use
The properties to output. Must be of type T
The filled range
Load a collection into the worksheet starting from the top left row of the range.
The datatype in the collection
The collection to load
to provide parameters to the function
sheet.Cells["C1"].LoadFromCollection(items, c =>
{
c.PrintHeaders = true;
c.TableStyle = TableStyles.Dark1;
});
The filled range
Loads a CSV text into a range starting from the top left cell.
Default settings is Comma separation
The Text
The range containing the data
Loads a CSV text into a range starting from the top left cell.
The Text
Information how to load the text
The range containing the data
Loads a CSV text into a range starting from the top left cell.
The Text
Information how to load the text
Create a table with this style. If this parameter is not null no table will be created.
Use the first row as header
Loads a CSV file into a range starting from the top left cell using ASCII Encoding.
The Textfile
Loads a CSV file into a range starting from the top left cell.
The Textfile
Information how to load the text
Loads a CSV file into a range starting from the top left cell.
The Textfile
Information how to load the text
Create a table with this style
Use the first row as header
Loads a fixed width text file into range starting from the top left cell.
The Text file
Information how to load the text
Loads a fixed width text file into range starting from the top left cell.
The Textfile
Information how to load the text
Loads a CSV file into a range starting from the top left cell.
The Textfile
Loads a CSV file into a range starting from the top left cell.
The Textfile
Information how to load the text
Loads a CSV file into a range starting from the top left cell.
The Textfile
Information how to load the text
Create a table with this style
Use the first row as header
Load a collection of dictionaries (or dynamic/ExpandoObjects) into the worksheet starting from the top left row of the range.
These dictionaries should have the same set of keys.
A list of dictionaries/>
The filled range
var items = new List<IDictionary<string, object>>()
{
new Dictionary<string, object>()
{
{ "Id", 1 },
{ "Name", "TestName 1" }
},
new Dictionary<string, object>()
{
{ "Id", 2 },
{ "Name", "TestName 2" }
}
};
using(var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("test");
var r = sheet.Cells["A1"].LoadFromDictionaries(items);
}
Load a collection of dictionaries (or dynamic/ExpandoObjects) into the worksheet starting from the top left row of the range.
These dictionaries should have the same set of keys.
A list of dictionaries/>
If true the key names from the first instance will be used as headers
The filled range
var items = new List<IDictionary<string, object>>()
{
new Dictionary<string, object>()
{
{ "Id", 1 },
{ "Name", "TestName 1" }
},
new Dictionary<string, object>()
{
{ "Id", 2 },
{ "Name", "TestName 2" }
}
};
using(var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("test");
var r = sheet.Cells["A1"].LoadFromDictionaries(items, true);
}
Load a collection of dictionaries (or dynamic/ExpandoObjects) into the worksheet starting from the top left row of the range.
These dictionaries should have the same set of keys.
A list of dictionaries/>
If true the key names from the first instance will be used as headers
Will create a table with this style. If set to TableStyles.None no table will be created
The filled range
var items = new List<IDictionary<string, object>>()
{
new Dictionary<string, object>()
{
{ "Id", 1 },
{ "Name", "TestName 1" }
},
new Dictionary<string, object>()
{
{ "Id", 2 },
{ "Name", "TestName 2" }
}
};
using(var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("test");
var r = sheet.Cells["A1"].LoadFromDictionaries(items, true, TableStyles.None);
}
Load a collection of dictionaries (or dynamic/ExpandoObjects) into the worksheet starting from the top left row of the range.
These dictionaries should have the same set of keys.
A list of dictionaries
If true the key names from the first instance will be used as headers
Will create a table with this style. If set to TableStyles.None no table will be created
Keys that should be used, keys omitted will not be included
The filled range
var items = new List<IDictionary<string, object>>()
{
new Dictionary<string, object>()
{
{ "Id", 1 },
{ "Name", "TestName 1" }
},
new Dictionary<string, object>()
{
{ "Id", 2 },
{ "Name", "TestName 2" }
}
};
using(var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("test");
var r = sheet.Cells["A1"].LoadFromDictionaries(items, true, TableStyles.None, null);
}
Load a collection of dictionaries (or dynamic/ExpandoObjects) into the worksheet starting from the top left row of the range.
These dictionaries should have the same set of keys.
A list of dictionaries
If true the key names from the first instance will be used as headers
Will create a table with this style. If set to TableStyles.None no table will be created
Keys that should be used, keys omitted will not be included
The filled range
var items = new List<IDictionary<string, object>>()
{
new Dictionary<string, object>()
{
{ "Id", 1 },
{ "Name", "TestName 1" }
},
new Dictionary<string, object>()
{
{ "Id", 2 },
{ "Name", "TestName 2" }
}
};
using(var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("test");
var r = sheet.Cells["A1"].LoadFromDictionaries(items, true, TableStyles.None, null);
}
Load a collection of dictionaries (or dynamic/ExpandoObjects) into the worksheet starting from the top left row of the range.
These dictionaries should have the same set of keys.
A list of dictionaries/ExpandoObjects
to provide parameters to the function
sheet.Cells["C1"].LoadFromDictionaries(items, c =>
{
c.PrintHeaders = true;
c.TableStyle = TableStyles.Dark1;
});
Load a collection of dictionaries (or dynamic/ExpandoObjects) into the worksheet starting from the top left row of the range.
These dictionaries should have the same set of keys.
A list of dictionaries/ExpandoObjects
to provide parameters to the function
sheet.Cells["C1"].LoadFromDictionaries(items, c =>
{
c.PrintHeaders = true;
c.TableStyle = TableStyles.Dark1;
});
Returns the range as a with the settings.
A representing the range.
Returns the range as a with the option supplied.
Configures the settings used to convert the range.
A representing the range.
Returns the range as a with the option supplied.
Sets the settings used to convert the range.
A representing the range.
Returns the range as a with the option supplied.
Configures the settings used to convert the range.
The data table to add the range data to.
A representing the range.
Returns the range as a with the option supplied.
The data table to add the range data to.
A representing the range.
Returns the range as a with the option supplied.
Sets the settings used to convert the range.
The data table to add the range data to.
A representing the range.
Converts a range to text in CSV format.
A string containing the text
Converts a range to text in CSV format.
Invariant culture is used by default.
Information how to create the csv text
A string containing the text
Converts a range to text in CSV format.
Invariant culture is used by default.
The file to write to
Information how to create the csv text
Converts a range to text in CSV format.
Invariant culture is used by default.
The strem to write to
Information how to create the csv text
Converts a range to text in Fixed Width format.
Invariant culture is used by default.
Information how to create the Fixed Width text
A string containing the text
Converts a range to text in fixed widths format.
Invariant culture is used by default.
The file to write to
Information how to create the fixed width text
Converts a range to text in Fixed Width format.
Invariant culture is used by default.
The strem to write to
Information how to create the fixed width text
Converts a range to text in CSV format.
A string containing the text
Converts a range to text in CSV format.
Invariant culture is used by default.
Information how to create the csv text
A string containing the text
Converts a range to text in CSV format.
Invariant culture is used by default.
The file to write to
Information how to create the csv text
Converts a range to text in CSV format.
Invariant culture is used by default.
The strem to write to
Information how to create the csv text
Converts a range to text in Fixed Width format.
Invariant culture is used by default.
Information how to create the Fixed Width text
A string containing the text
Converts a range to text in fixed widths format.
Invariant culture is used by default.
The file to write to
Information how to create the fixed width text
Converts a range to text in Fixed Width format.
Invariant culture is used by default.
The strem to write to
Information how to create the fixed width text
Returns the range as JSON
A JSON string
Returns the range as JSON
Configures settings for the JSON export
Saves the range as JSON to a stream.
The writable stream to write the JSON to.
Saves the range as JSON to a stream.
The writable stream to write the JSON to
Configures settings for the JSON export
Save the range to json
The stream to save to.
Save the range to json
The stream to save to.
Settings for the json output.
Returns a collection of T for the range.
If the range contains multiple addresses the first range is used.
The first row must containt the unique headers used as keys in the row dictionary.
The type to map to
The call back function to map each row to the item of type T.
A list of T
Returns a collection of T for the range.
If the range contains multiple addresses the first range is used.
The first row must contain the unique headers used as keys in the row dictionary.
The type to map to
The call back function to map each row to the item of type T.
Configures the settings for the function
A list of T
Returns a collection of T for the range.
If the range contains multiple addresses the first range is used.
The first row must containt the unique headers used as keys in the row dictionary.
The type to map to
The call back function to map each row to the item of type T.
Parameters to the function
A list of T
Returns a collection of T for the range.
If the range contains multiple addresses the first range is used.
The first row must contain the unique headers used as keys in the row dictionary.
Headers will be mapped to properties using the name or the attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to map to
A list of T
Automatically maps the range to the properties using the headers.
Using this method requires a headers.
Headers will be mapped to properties using the name or the attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to use
Configures the settings for the function
A list of
Automatically maps the range to the properties using the headers.
Using this method requires a headers.
Headers will be mapped to properties using the name or the attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to use
Settings for the method
A list of
A column in a worksheet
If the column is collapsed in outline mode
Outline level. Zero if no outline
Phonetic
If set to true a column automaticlly resize(grow wider) when a user inputs numbers in a cell.
Set the column width from the content.
Note: Cells containing formulas are ignored unless a calculation is performed.
Wrapped and merged cells are also ignored.
Minimum column width
Maximum column width
Adds a manual page break after the column.
Groups the columns using an outline.
Adds one to for each column if the outline level is less than 8.
Ungroups the columns from the outline.
Subtracts one from for each column if the outline level is larger that zero.
Collapses and hides the column's children. Children are columns immegetaly to the right or left of the column depending on the
If true, all children will be collapsed and hidden. If false, only the children of the referenced columns are collapsed.
Expands and shows the column's children. Children are columns immegetaly to the right or left of the column depending on the
If true, all children will be expanded and shown. If false, only the children of the referenced columns will be expanded.
Expands the columns to the supplied.
Expand all columns with a Equal or Greater than this number.
Collapse all children with a greater than
Represents a range of columns
The first column in the collection
The last column in the collection
If the column is collapsed in outline mode
Groups the columns using an outline. Adds one to for each column if the outline level is less than 8.
Ungroups the columns from the outline.
Subtracts one from for each column if the outline level is larger that zero.
Collapses and hides the column's children. Children are columns immegetaly to the right or left of the column depending on the
If true, all children will be collapsed and hidden. If false, only the children of the referenced columns are collapsed.
Expands and shows the column's children. Children are columns immegetaly to the right or left of the column depending on the
If true, all children will be expanded and shown. If false, only the children of the referenced columns will be expanded.
Expands the rows to the supplied.
Expands all rows with a Equal or Greater than this number.
Collapses all children with a greater than
Outline level. Zero if no outline. Can not be negative.
True if the column should show phonetic
Indicates that the column should resize when numbers are entered into the column to fit the size of the text.
This only applies to columns where the size has not been set.
If the column is hidden.
Row width of the column.
Adds a manual page break after the column.
The Style applied to the whole column(s). Only effects cells with no individual style set.
Use Range object if you want to set specific styles.
Sets the style for the entire column using a style name.
Sets the style for the entire column using the style ID.
The current range when enumerating
The current range when enumerating
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored.
The minimum width is the value of the ExcelWorksheet.defaultColumnWidth property.
Cells containing formulas must be calculated before autofit is called.
Wrapped and merged cells are also ignored.
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored.
This method will not work if you run in an environment that does not support GDI.
Cells containing formulas are ignored if no calculation is made.
Wrapped and merged cells are also ignored.
Minimum column width
Set the column width from the content of the range. Columns outside of the worksheets dimension are ignored.
This method will not work if you run in an environment that does not support GDI.
Cells containing formulas are ignored if no calculation is made.
Wrapped and merged cells are also ignored.
Minimum column width
Maximum column width
Reference to the cell range of the column(s)
Gets the enumerator
Gets the enumerator
Iterate to the next row
False if no more row exists
Reset the enumerator
Disposes this object
Flag enum, specify all flags that you want to exclude from the copy.
Exclude formulas from being copied. Only the value of the cell will be copied
Will exclude formulas and values from being copied
Exclude styles from being copied.
Exclude comments from being copied.
Exclude threaded comments from being copied.
Exclude hyperlinks from being copied.
Exclude merged cells from being copied.
Exclude data validations from being copied.
Exclude conditional formatting from being copied.
Transpose the copied data
Exclude drawings from being copied
A row in a worksheet
If the row is collapsed in outline mode
Outline level. Zero if no outline
True if the row should show phonetic
If the row is hidden.
Row height in points if specified manually.
Adds a manual page break after the column.
True if height is set manually
Groups the rows using an outline.
Adds one to for each row if the outline level is less than 8.
Ungroups the rows from the outline.
Subtracts one from for each row if the outline level is larger that zero.
Collapses and hides the rows's children. Children are rows immegetaly below or top of the row depending on the
If true, all children will be collapsed and hidden. If false, only the children of the referenced rows are collapsed.
Expands and shows the rows's children. Children are columns immegetaly below or top of the row depending on the
If true, all children will be expanded and shown. If false, only the children of the referenced columns will be expanded.
Expands the rows to the supplied.
Expands all rows with a Equal or Greater than this number.
Collapses all children with a greater than
Represents a range of rows
The first row in the collection
The last row in the collection
If the row is collapsed in outline mode
Outline level. Zero if no outline
True if the row should show phonetic
If the row is hidden.
Row height in points. Setting this property will also set to true.
True if the row has been manually set.
Adds a manual page break after the column.
The Style applied to the whole row(s). Only effects cells with no individual style set.
Use the Range object if you want to set specific styles.
Sets the style for the entire row using a style name.
Sets the style for the entire column using the style ID.
Reference to the cell range of the row(s)
The current row object in the iteration
The current row object in the iteration
Gets the enumerator
Gets the enumerator
Iterate to the next row
False if no more row exists
Reset the enumerator
Disposes this object
Groups the rows using an outline.
Adds one to for each row if the outline level is less than 8.
Ungroups the rows from the outline.
Subtracts one from for each row if the outline level is larger that zero.
Collapses and hides the rows's children. Children are rows immegetaly below or top of the row depending on the
If true, all children will be collapsed and hidden. If false, only the children of the referenced rows are collapsed.
Expands and shows the rows's children. Children are columns immegetaly below or top of the row depending on the
If true, all children will be expanded and shown. If false, only the children of the referenced columns will be expanded.
Expands the rows to the supplied.
Expand all rows with a Equal or Greater than this number.
Collapse all children with a greater than
Represents an individual row in the spreadsheet.
Internal RowID.
Creates a new instance of the ExcelRow class.
For internal use only!
The parent worksheet
The row number
Provides access to the node representing the row.
Allows the row to be hidden in the worksheet
Sets the height of the row
Set to true if You don't want the row to Autosize
Sets the style for the entire column using a style name.
Sets the style for the entire row using the style ID.
Rownumber
If outline level is set this tells that the row is collapsed.
Setting this property will not hide the children.
Use the or methods to collapse and hide columns/rows via the collection.
Outline level.
Show phonetic Information
The Style applied to the whole row. Only effekt cells with no individual style set.
Use the Style property if you want to set specific styles.
Adds a manual page break after the row.
Merge all cells in the row
Copies the current row to a new worksheet
The worksheet where the copy will be created
A collection of rows in a worksheet.
Indexer for the collection
The row index
The
Indexer for the collection
The row index from which collection should start
index from which collection should end
The
Sheet protection
If the worksheet is protected.
Allow users to select locked cells
Allow users to select unlocked cells
Allow users to edit objects
Allow users to edit senarios
Allow users to format cells
Allow users to Format columns
Allow users to Format rows
Allow users to insert columns
Allow users to Format rows
Allow users to insert hyperlinks
Allow users to delete columns
Allow users to delete rows
Allow users to sort a range
Allow users to use autofilters
Allow users to use pivottables
Sets a password for the sheet.
A collection of named styles in the workbooks styles.
The type of style
Indexer for the collection
The name of the Style
Base collection class for styles.
The style type
The top xml node of the collection
Returns an enumerator that iterates through a collection.
The enumerator
Returns an enumerator that iterates through a collection.
The enumerator
Indexer for the collection
The index of the Style
Number of items in the collection
Finds the key
the key to be found
The found object.
True if found
Find Index
Containts all shared cell styles for a workbook
Loads the style XML to memory
Handels changes of properties on the style objects
Handles property changes on Named styles.
Contains all numberformats for the package
Contains all font styles for the package
Contains all fill styles for the package
Contain all border styles for the package
Contain all named cell styles for the package
Contain all cell styles for the package
Contain all named styles for the package
Contain all table styles for the package. Tables styles can be used to customly format tables and pivot tables.
Contain all slicer styles for the package. Tables styles can be used to customly format tables and pivot tables.
Contain differential formatting styles for the package. This collection does not contain style records for slicers.
Creates a named style that can be applied to cells in the worksheet.
The name of the style
A named style object that can be custumized
Creates a named style that can be applied to cells in the worksheet.
The name of the style
A template style
A named style object that can be custumized
Creates a tables style only visible for pivot tables and with elements specific to pivot tables.
The name of the style
The table style object
Creates a tables style only visible for pivot tables and with elements specific to pivot tables.
The name of the style
The built-in table style to use as a template for this custom style
The table style object
Creates a tables style only visible for pivot tables and with elements specific to pivot tables.
The name of the style
The table style to use as a template for this custom style
The table style object
Creates a tables style only visible for tables and with elements specific to pivot tables.
The name of the style
The table style object
Creates a tables style only visible for tables and with elements specific to pivot tables.
The name of the style
The built-in table style to use as a template for this custom style
The table style object
Creates a tables style only visible for tables and with elements specific to pivot tables.
The name of the style
The table style to use as a template for this custom style
The table style object
Creates a tables visible for tables and pivot tables and with elements for both.
The name of the style
The table style object
Creates a tables visible for tables and pivot tables and with elements for both.
The name of the style
The built-in table style to use as a template for this custom style
The table style object
Creates a tables visible for tables and pivot tables and with elements for both.
The name of the style
The built-in pivot table style to use as a template for this custom style
The table style object
Creates a tables visible for tables and pivot tables and with elements for both.
The name of the style
The table style to use as a template for this custom style
The table style object
Creates a custom slicer style.
The name of the style
The slicer style object
Creates a custom slicer style.
The name of the style
The slicer style to use as a template for this custom style
The slicer style object
Creates a custom named slicer style from another style.
The name of the style.
The slicer style to us as template.
Update the changes to the Style.Xml file inside the package.
This will remove any unused styles from the collections.
Extended address information for a table address
The name of the table
Column span
Reference entire table
Reference the table header row
Reference table data
Reference table totals row
Reference the current table row
Describes how to split a CSV text. Used by the ExcelRange.SaveFromText method
Describes how to split a CSV text
Default values
PropertyValue
- Delimiter,
- TextQualifierNone (\0)
- EOLCRLF
- CultureCultureInfo.InvariantCulture
- SkipLinesBeginning0
- SkipLinesEnd0
- Header
- Footer
- FirstRowIsHeadertrue
- EncodingEncoding.ASCII
- UseCellFormattrue
- FormatsFormats can be .NET number format, dateformats. For text use a $. A blank formats will try to autodetect
- DecimalSeparatorFrom Culture(null)
- ThousandsSeparatorFrom Culture(null)
A text written at the start of the file.
A text written at the end of the file
Use the cells Text property with the applied culture.
This only applies to columns with no format set in the Formats collection.
If SkipLinesBeginning is larger than zero, headers will still be read from the first row in the range.
If a TextQualifier is set, non numeric and date columns will be wrapped with the TextQualifier
A specific .NET format for the column.
Format is applied with the used culture.
For a text column use $ as format
Decimal separator, if other than the used culture.
Thousands separator, if other than the used culture.
What to replace Text Qualifiers inside a text, when String Qualifiers is set.
Default is two Text Qualifiers characters. For example " is replaced with "".
Set if data in worksheet is transposed.
Padding types, can be left, right or auto.
Detects the padding type automatically. Text will be left and numbers will be right.
Add padding to the left.
Add padding to the right.
Describes how to output an fixed width text file.
Describes how to split a fixed width text
A text written at the start of the file.
A text written at the end of the file
Flag to exclude header for fixed width text file
Use the cells Text property with the applied culture.
This only applies to columns with no format set in the Formats collection.
If SkipLinesBeginning is larger than zero, headers will still be read from the first row in the range.
If a TextQualifier is set, non numeric and date columns will be wrapped with the TextQualifier
A specific .NET format for the column.
Format is applied with the used culture.
For a text column use $ as format
Decimal separator, if other than the used culture.
Thousands separator, if other than the used culture.
What to replace Text Qualifiers inside a text, when Text Qualifiers is set.
Default is two Text Qualifiers characters. For example " is replaced with "".
Set this to output file with trailing minus signs.
Describes how to split a text file. Used by the ExcelRange.LoadFromText method.
Base class for ExcelTextFormatBase, ExcelTextFormatFixedWidthBase
End of line characters. Default is CRLF
Culture used when parsing. Default CultureInfo.InvariantCulture
Number of lines skipped in the begining of the file. Default 0.
Number of lines skipped at the end of the file. Default 0.
Only used when reading/writing files from disk using a FileInfo object. Default AscII
Will be called for each row. Should return true if the row should be used in the export/import, otherwise false
Set if data should be transposed
If not null, create a table from the import with this style.
The first row used contains the headers. Will be used if the import has a TableStyle set.
Discribes a column when reading a text using the ExcelRangeBase.LoadFromText method
Let the the import decide.
Always a string.
Try to convert it to a number. If it fails then add it as a string.
Try to convert it to a date. If it fails then add it as a string.
Try to convert it to a number and divide with 100.
Removes any tailing percent sign (%). If it fails then add it as a string.
Describes how to split a CSV text. Used by the ExcelRange.LoadFromText method
Describes how to split a CSV text
Default values
PropertyValue
- Delimiter,
- TextQualifierNone (\0)
- EOLCRLF
- CultureCultureInfo.InvariantCulture
- SkipLinesBeginning0
- SkipLinesEnd0
- DataTypesColumn datatypes
- EncodingEncoding.ASCII
Describes how to split a CSV text. Used by the ExcelRange.LoadFromText method.
Base class for ExcelTextFormat and ExcelOutputTextFormat
Creates a new instance if ExcelTextFormatBase
Delimiter character
Text qualifier character. Default no TextQualifier (\0)
Datatypes list for each column (if column is not present Unknown is assumed)
The name of the column
The start position of the column, is equal to -1 if not set
The length of the column.
The data type of the column. Is set to Unknown by default
The padding type of the column. Is set to auto by default, which will try to pad numbers to the right and strings to the left.
Flag to set if column should be used when reading and writing fixed width text.
Describes how to split a fixed width text. Used by the ExcelRange.LoadFromText method
How to handle missmatch with data and column format specifications.
If data is larger than format specification, write anyway. Might lead to data loss.
If data is larger than format specification, throw error
Describes how to import a fixed width text file.
The collection of column formats.
The strategy to use when writing fixed width text files.
Padding character for Text Can be set to null to skip trimming padding characters when reading
Padding character for numbers.
Set if we should read fixed width files from column widths or positions. Default is widths
The length of the line to read. If set to widths, LineLength is sum of all columnLengths. If set to positions, LineLength is set to the value of the last index of columnLengths
Clear the collection of column formats.
Set the column length properties of fixed width text. For reading to end of line, set last index to 0 or a negative number.
Set the column start positions of fixed width text.
The Length of a line. Set to 0 or negative to read until end of line.
The positions where each column starts. This array requires atleast one element.
Set the data types for each column.
Set the padding type for each column.
Set flag for each column to be used.
Set flag for each column to be used.
This class contains settings for text measurement.
This is the primary text measurer
If the primary text measurer fails to measure the text, this one will be used.
All measurements of texts will be multiplied with this value. Default is 1.
Returns an instance of the internal generic text measurer
Measures a text with default settings when there is no other option left...
How the application should calculate formulas in the workbook
Indicates that calculations in the workbook are performed automatically when cell values change.
The application recalculates those cells that are dependent on other cells that contain changed values.
This mode of calculation helps to avoid unnecessary calculations.
Indicates tables be excluded during automatic calculation
Indicates that calculations in the workbook be triggered manually by the user.
Represents the Excel workbook and provides access to all the
document properties and worksheets within the workbook.
Creates a new instance of the ExcelWorkbook class.
The parent package
NamespaceManager
Load all pivot cache ids and there uri's
Read shared strings to list
Provides access to all the worksheets in the workbook.
Note: Worksheets index either starts by 0 or 1 depending on the Excelpackage.Compatibility.IsWorksheets1Based property.
Default is 1 for .Net 3.5 and .Net 4 and 0 for .Net Core.
Create an html exporter for the supplied ranges.
The ranges to create the report from. All ranges must originate from the current workbook.
The HTML exporter.
Provides access to named ranges
A collection of links to external workbooks and it's cached data.
This collection can also contain DDE and OLE links. DDE and OLE are readonly and cannot be added.
Manage the formula parser.
Add your own functions or replace native ones, parse formulas or attach a logger.
Represents a collection of s in the workbook.
Max font width for the workbook, used in the calculation of column widths.
This property uses the static dictionary to get the max font width />
Access properties to protect or unprotect a workbook
Access to workbook view properties
A reference to the VBA project.
Null if no project exists.
Use Workbook.CreateVBAProject to create a new VBA-Project
Remove the from the file VBA project.
Create an empty VBA project.
Calculate all pivot tables in the workbook.
Also see and
If the cache should be refreshed.
URI to the workbook inside the package
URI to the styles inside the package
URI to the shared strings inside the package
URI to the person elements inside the package
Returns a reference to the workbook's part within the package
Provides access to the XML data representing the workbook in the package.
The VBA code module if the package has a VBA project. Otherwise this propery is null.
The date systems used by Microsoft Excel can be based on one of two different dates. By default, a serial number of 1 in Microsoft Excel represents January 1, 1900.
The default for the serial number 1 can be changed to represent January 2, 1904.
This option was included in Microsoft Excel for Windows to make it compatible with Excel for the Macintosh, which defaults to January 2, 1904.
Create or read the XML for the workbook.
Provides access to the XML data representing the styles in the package.
Package styles collection. Used internally to access style data.
The office document properties
Calculation mode for the workbook.
Should Excel do a full calculation after the workbook has been loaded?
This property is always true for both new workbooks and loaded templates(on load). If this is not the wanted behavior set this property to false.
Create and manage the theme for the workbook.
The default version of themes to apply in the workbook
If false, EPPlus will round cell values to the number of decimals as displayed in the cell by using the cells number format when calculating the workbook.
If true, full precision will be used on calculation.
Saves the workbook and all its components to the package.
For internal use only!
Is their any names in the workbook or in the sheets.
?
Removes all formulas within the entire workbook, but keeps the calculated values.
Removes all values of cells with formulas in the entire workbook, but keeps the formulas.
Disposes the workbooks
Returns true if the workbook has pivot tables in any worksheet.
Handler for the property to override the default behaviour.
This can be used to handle localized number formats or formats where EPPlus differs from the spread sheet application.
Access to workbook view properties
Creates a new ExcelWorkbookView which provides access to all the
view states of the worksheet.
Position of the upper left corner of the workbook window. In twips.
Position of the upper left corner of the workbook window. In twips.
Width of the workbook window. In twips.
Height of the workbook window. In twips.
If true the the workbook window is minimized.
Show the vertical scrollbar
Show the horizontal scrollbar
Show or hide the sheet tabs
Set the window position in twips
Left coordinat
Top coordinat
Width in twips
Height in twips
The active worksheet in the workbook. Zero based.
The first visible worksheet in the worksheets collection.
Represents an Excel worksheet and provides access to its properties and methods
Keeps track of meta data referencing cells or values.
Removes all formulas within the entire worksheet, but keeps the calculated values.
Removes all values of cells with formulas in the entire worksheet, but keeps the formulas.
Collection containing merged cell addresses
Indexer for the collection
The Top row of the merged cells
The Left column of the merged cells
Indexer for the collection
The index in the collection
Number of items in the collection
Gets the enumerator for the collection
The enumerator
A worksheet
Namespacemanager
Package
Relationship ID
URI
Name of the sheet
Sheet id
Position
hide
The Uri to the worksheet within the package
The Zip.ZipPackagePart for the worksheet within the package
The ID for the worksheet's relationship with the workbook in the package
The unique identifier for the worksheet.
The position of the worksheet.
The index in the worksheets collection
Address for autofilter
The auto filter address.
null means no auto filter.
Autofilter settings
Sets the sort state
Returns a ExcelWorksheetView object that allows you to set the view state properties of the worksheet
The worksheet's display name as it appears on the tab
Provides access to named ranges
Indicates if the worksheet is hidden in the workbook
Get/set the default height of all rows in the worksheet
If true, empty rows are hidden by default.
This reduces the size of the package and increases performance if most of the rows in a worksheet are hidden.
'True' if defaultRowHeight value has been manually set, or is different from the default value.
Is automaticlly set to 'True' when assigning the DefaultRowHeight property
Get/set the default width of all columns in the worksheet
*
If true, summary rows are showen below the details, otherwise above.
If true, summary columns are to right of details otherwise to the left.
Automatic styles
Color of the sheet tab
The VBA code modul for the worksheet, if the package contains a VBA project.
The XML document holding the worksheet data.
All column, row, cell, pagebreak, merged cell and hyperlink-data are loaded into memory and removed from the document when loading the document.
Vml drawings. underlaying object for comments
Collection of comments
A collection of threaded comments referenced in the worksheet.
Get the lenth of the attributes
Conditional formatting attributes can be extremly long som get length of the attributes to finetune position.
Load Hyperlinks
The reader
Load cells
The reader
Load merged cells
Reads a row from the XML reader
The reader
The row number
A reference to the header and footer class which allows you to
set the header and footer for all odd, even and first pages of the worksheet
To format the text you can use the following format
PrefixDescription
- &UUnderlined
- &EDouble Underline
- &K:xxxxxxColor. ex &K:FF0000 for red
- &"Font,Regular Bold Italic"Changes the font. Regular or Bold or Italic or Bold Italic can be used. ex &"Arial,Bold Italic"
- &nnChange font size. nn is an integer. ex &24
- &GPlaceholder for images. Images cannot be added by the library, but its possible to use in a template.
Printer settings
Provides access to a range of cells
Provides access to the selected range of cells
Addresses to merged ranges
Provides access to an individual row within the worksheet so you can set its properties.
The row number in the worksheet
Provides access to an individual column within the worksheet so you can set its properties.
The column number in the worksheet
Returns the name of the worksheet
The name of the worksheet
Make the current worksheet active.
Selects a range in the worksheet. The active cell is the topmost cell.
Make the current worksheet active.
An address range
Selects a range in the worksheet. The actice cell is the topmost cell.
A range of cells
Make the sheet active
Selects a range in the worksheet. The active cell is the topmost cell of the first address.
Make the current worksheet active.
An address range
Selects a range in the worksheet. The active cell is the topmost cell of the first address.
A range of cells
Make the sheet active
Inserts new rows into the spreadsheet. Existing rows below the position are
shifted down. All formula are updated to take account of the new row(s).
The position of the new row(s)
Number of rows to insert
Inserts new rows into the spreadsheet. Existing rows below the position are
shifted down. All formula are updated to take account of the new row(s).
The position of the new row(s)
Number of rows to insert.
Copy Styles from this row. Applied to all inserted rows
Inserts new columns into the spreadsheet. Existing columns below the position are
shifted down. All formula are updated to take account of the new column(s).
The position of the new column(s)
Number of columns to insert
Inserts new columns into the spreadsheet. Existing column to the left are
shifted. All formula are updated to take account of the new column(s).
The position of the new column(s)
Number of columns to insert.
Copy Styles from this column. Applied to all inserted columns
Delete the specified row from the worksheet.
A row to be deleted
Delete the specified rows from the worksheet.
The start row
Number of rows to delete
Deletes the specified rows from the worksheet.
The number of the start row to be deleted
Number of rows to delete
Not used. Rows are always shifted
Delete the specified column from the worksheet.
The column to be deleted
Delete the specified columns from the worksheet.
The start column
Number of columns to delete
Get the cell value from the worksheet
The row number
The row number
The value
Fetches the value adapted for the pivot cache.
The value is converted depending on the data type.
The row number
The row number
The value
Get a strongly typed cell value from the worksheet
The type
The row number
The row number
The value. If the value can't be converted to the specified type, the default value will be returned
Set the value of a cell
The row number
The column number
The value
Set the value of a cell
The Excel address
The value
Get MergeCell Index No
Delete the printersettings relationship and part.
Save all table data
Dimension address for the worksheet for cells with a value or a style set.
Top left cell to Bottom right.
If the worksheet has no cells, null is returned
Dimension address for the worksheet for cells with a value different than null.
Top left cell to Bottom right.
If the worksheet has no cells, null is returned
The first cell with a value in the worksheet that differs from null.
Normally this is the top-left cell, unless the worksheet is set to RightToLeft mode.
The last cell with a value in the worksheet that differs from null.
Normally this is the bottom-right cell, unless the worksheet is set to RightToLeft mode.
Access to sheet protection properties
Access to protected ranges in the worksheet
Collection of drawing-objects like shapes, images and charts
Collection of Sparkline-objects.
Sparklines are small in-cell charts.
Tables defined in the worksheet.
Pivottables defined in the worksheet.
ConditionalFormatting defined in the worksheet. Use the Add methods to create ConditionalFormatting and add them to the worksheet. Then
set the properties on the instance returned.
DataValidation defined in the worksheet. Use the Add methods to create DataValidations and add them to the worksheet. Then
set the properties on the instance returned.
Must know worksheet or at least worksheet name to determine if extLst when user input DataValidations in API.
Ignore Errors for the specified ranges and error types.
An image displayed as the background of the worksheet.
The workbook object
Get the next ID from a shared formula or an Array formula
Sharedforumlas will have an id from 0-x. Array formula ids start from 0x4000001-.
If the formula is an array formula
Disposes the worksheet
Get the ExcelColumn for column (span ColumnMin and ColumnMax)
Check if a worksheet is equal to another
First worksheet
Second worksheet
Returns a hashcode generated from the WorksheetXml
The worksheet
The hashcode
A collection of row specific properties in the worksheet.
A collection of column specific properties in the worksheet.
Get accessor of sheet value
row
column
cell value
Get accessor of sheet value
row
column
cell value
Get accessor of sheet styleId
row
column
cell styleId
Set accessor of sheet value
row
column
value
Set accessor of sheet styleId
row
column
styleId
Set accessor of sheet styleId
row
column
value
styleId
Bulk(Range) set accessor of sheet value, for value array
start row
start column
end row
end column
set values
Will add built in styles for hyperlinks
If the value is of type Uri or ExcelHyperlink the Hyperlink property is set.
Existance check of sheet value
row
column
is exists
Existance check of sheet styleId
row
column
is exists
Existence check of sheet value
row
column
is exists
Existence check of sheet styleId
row
column
is exists
Gets the range for the formula in the cell.
A shared formula will return the range for the entire series.
An array formula will return the range of the output of the formula.
If you want the range of a dynamic array formula, you must calculate the formula first.
The row of the cell containing the formula.
The column of the cell containing the formula.
The range the formula spans
The collection of worksheets for the workbook
Returns the number of worksheets in the workbook
Foreach support
An enumerator
Adds a new blank worksheet.
The name of the workbook
Adds a copy of a worksheet
The name of the workbook
The worksheet to be copied
Adds a chartsheet to the workbook.
The name of the worksheet
The type of chart
Adds a chartsheet to the workbook.
The name of the worksheet
The type of chart
The pivottable source
Adds a stock chart sheet to the workbook.
The name of the worksheet
The category serie. A serie containing dates or names
The high price serie
The low price serie
The close price serie containing
The opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart
The volume represented as a column chart. Supplying this serie will create a StockVHLC or StockVOHLC chart
Get first visible index counted from input index.
The index to start checking from
Validate the sheetname
The name
True if valid
Creates the XML document representing a new empty worksheet
Deletes a worksheet from the collection
The position of the worksheet in the workbook
Deletes a worksheet from the collection
The name of the worksheet in the workbook
Delete a worksheet from the collection
The worksheet to delete
Returns the worksheet at the specified position.
The position of the worksheet. Collection is zero-based or one-base depending on the Package.Compatibility.IsWorksheets1Based propery. Default is Zero based
Returns the worksheet matching the specified name
The name of the worksheet
Copies the named worksheet and creates a new worksheet in the same workbook
The name of the existing worksheet
The name of the new worksheet to create
The new copy added to the end of the worksheets collection
Return a worksheet by its name. Can throw an exception if the worksheet does not exist.
name of the reqested worksheet
name of the parameter
Throws an if the worksheet doesn't exist.
Moves the source worksheet to the position before the target worksheet
The name of the source worksheet
The name of the target worksheet
Moves the source worksheet to the position before the target worksheet
The id of the source worksheet
The id of the target worksheet
Moves the source worksheet to the position after the target worksheet
The name of the source worksheet
The name of the target worksheet
Moves the source worksheet to the position after the target worksheet
The id of the source worksheet
The id of the target worksheet
Moves the source worksheet to the start of the worksheets collection
The name of the source worksheet
Moves the source worksheet to the start of the worksheets collection
The position of the source worksheet
Moves the source worksheet to the end of the worksheets collection
The name of the source worksheet
Moves the source worksheet to the end of the worksheets collection
The position of the source worksheet
Dispose the worksheets collection
The state of the pane.
Panes are frozen, but were not split being frozen.In this state, when the panes are unfrozen again, a single pane results, with no split. In this state, the split bars are not adjustable.
Frozen Split
Panes are frozen and were split before being frozen. In this state, when the panes are unfrozen again, the split remains, but is adjustable.
Panes are split, but not frozen.In this state, the split bars are adjustable by the user.
The position of the pane.
Bottom Left Pane.
Used when worksheet view has both vertical and horizontal splits.
Also used when the worksheet is horizontaly split only, specifying this is the bottom pane.
Bottom Right Pane.
This property is only used when the worksheet has both vertical and horizontal splits.
Top Left Pane.
Used when worksheet view has both vertical and horizontal splits.
Also used when the worksheet is horizontaly split only, specifying this is the top pane.
Top Right Pane
Used when the worksheet view has both vertical and horizontal splits.
Also used when the worksheet is verticaly split only, specifying this is the right pane.
Represents the different view states of the worksheet
Defines general properties for the panes, if the worksheet is frozen or split.
The state of the pane.
The active pane
The horizontal position of the split. 1/20 of a point if the pane is split. Number of columns in the top pane if this pane is frozen.
The vertical position of the split. 1/20 of a point if the pane is split. Number of rows in the left pane if this pane is frozen.
The selection properties for panes after a freeze or split.
Set the active cell. Must be set within the SelectedRange.
The position of the pane.
Selected Cells. Used in combination with ActiveCell
Creates a new ExcelWorksheetView which provides access to all the view states of the worksheet.
Returns a reference to the sheetView element
The active cell. Single cell address.
This cell must be inside the selected range. If not, the selected range is set to the active cell address
The Top-Left Cell visible. Single cell address.
Empty string or null is the same as A1.
Selected Cells in the worksheet. Used in combination with ActiveCell.
If the active cell is not inside the selected range, the active cell will be set to the first cell in the selected range.
If the selected range has multiple adresses, these are separated with space. If the active cell is not within the first address in this list, the attribute ActiveCellId must be set (not supported, so it must be set via the XML).
Contains settings for the active pane
If the worksheet is selected within the workbook. NOTE: Setter clears other selected tabs.
If the worksheet is selected within the workbook. NOTE: Setter keeps other selected tabs.
Sets whether the worksheet is selected within the workbook.
Whether the tab is selected, defaults to true.
Whether to allow multiple active tabs, defaults to false.
Sets the view mode of the worksheet to pagelayout
Sets the view mode of the worksheet to pagebreak
Show gridlines in the worksheet
Show the Column/Row headers (containg column letters and row numbers)
Window zoom magnification for current view representing percent values.
If the sheet is in 'right to left' display mode. Column A is on the far right and column B to the left of A. Text is also 'right to left'.
Reference to the panes
The top left pane or the top pane if the sheet is horizontaly split. This property returns null if the pane does not exist in the array.
The top right pane. This property returns null if the pane does not exist in the array.
The bottom left pane. This property returns null if the pane does not exist in the array.
The bottom right pane. This property returns null if the pane does not exist in the array.
Freeze the columns and rows starting from
Rows from the . Starts from 1
Columns from the . Starts from 1
Split panes at the position in pixels from the top-left corner.
Vertical pixels
Horizontal pixels
Split the window at the supplied row/column.
The split is performed using the current width/height of the visible rows and columns, so any changes to column width or row heights after the split will not effect the split position.
To remove split call this method with zero as value of both paramerters or use
Splits the panes at the coordinate after this visible row. Zero mean no split on row level
Splits the panes at the coordinate after this visible column. Zero means no split on column level.
Unlock all rows and columns to scroll freely
This class contains settings for usage of accessibility/ARIA attributes in the exported html.
Settings for a html table
This class controls how accessibility attributes will be set in the exported html.
Reset all properties to their default value
Copies all properties from one instance to another.
Controls whether accessibility attributes will be added to the html.
Value of the aria-label attribute
Value of the aria-labelledby attribute
Value of the aria-describedby attribute
Value of the role attribute on the table element. Default value: table
Value of the role attribute on the thead element. Default value: rowgroup
Value of the role attribute on the tbody element. Default value: rowgroup
Value of the role attribute on the tfoot element. Default value: rowgroup
Value of the role attribute on the thead.tr.td element. Default value: columnheader
Order is reversed so that int.Max values are written first.
And the lowest value is written last.
This as Priority for conditional formattings is reversed so that 1 is the highest priority.
This would otherwise conflict with css where the Last written css style has highest priority.
Shorthand for ".Declarations.Add(new Declaration(name, values))"
Index operator, returns by 0-based index
A css Declaration is the combo of a property and its values.
Exclude border properties in the css
Exclude all border properties.
Exclude top border properties
Exclude bottom border properties
Exclude left border properties
Exclude right border properties
Exclude font properties in the css
Exclude all font properties.
Exclude the font name property
Exclude the font size property
Exclude the font color property
Exclude the font bold property
Exclude the font italic property
Exclude the font strike property
Exclude the font underline property
How hidden rows are handled.
Exclude hidden rows
Include hidden rows, but hide them.
Include hidden rows.
How the text alignment is handled when the style is set to General
Dont set any alignment when alignment is set to general
If the column data type is numeric or date, alignment will be right otherwise left.
If the cell value data type is numeric or date, alignment will be right otherwise left.
How to include picture drawings in the html
Do not include pictures in the html export. Default
Include in css only, so they images can be added manually.
Include the images in the html export.
If the Picture is absolut or relative to the table cell
No CSS is added for Position
Position is Absolute in the CSS
Position is Relative in the CSS
Base class for Html exporters
Constructor
Constructor
Exported ranges
Exports an to a html string
A html table
Exports an to a html string
0-based index of the requested range
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
Exports an to a html string
The stream to write to
A html table
Exports an to a html string
The stream to write to
The index of the range to output.
Settings for this specific range index
A html table
Exports an to a html string
The stream to write to
The index of the range to output.
Settings for this specific range index
A html table
Renders both the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports an to a html string
Cascading style sheet for the exported range
Exports the css part of the html export.
The stream to write the css to.
Exports an to a html string
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
Exports an to a html string
The stream to write to
A html table
Exports the html part of the html export, without the styles.
The stream to write to.
The index of the range to output.
Settings for this specific range index
Exports the html part of the html export, without the styles.
The stream to write to.
Index of the range to export
Override some of the settings for this html exclusively
Renders the first range of the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports the css part of an to a html string
A html table
Exports the css part of an to a html string
A html table
Exports an to a html string
A html table
Exports an to a html string
The stream to write to
A html table
Renders both the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports an to a html string
Cascading style sheet for the exported range
Exports the css part of the html export.
The stream to write the css to.
Exports an to a html string
A html table
Exports an to a html string
The stream to write to
A html table
Renders the first range of the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports the css part of an to a html string
A html table
Exports the css part of an to a html string
A html table
Exports an to a html string
A html table
Exports an to a html string
0-based index of the requested range
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
Exports an to a html string
The stream to write to
A html table
Exports an to a html string
The stream to write to
The index of the range to output.
Settings for this specific range index
A html table
Exports an to a html string
The stream to write to
The index of the range to output.
Settings for this specific range index
A html table
Renders both the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports an to a html string
Cascading style sheet for the exported range
Exports the css part of the html export.
The stream to write the css to.
Exports an to a html string
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
Exports an to a html string
The stream to write to
A html table
Exports the html part of the html export, without the styles.
The stream to write to.
The index of the range to output.
Settings for this specific range index
Exports the html part of the html export, without the styles.
The stream to write to.
Index of the range to export
Override some of the settings for this html exclusively
Renders the first range of the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports the css part of an to a html string
A html table
Exports the css part of an to a html string
A html table
Exports an to a html string
A html table
Exports the css part of the html export.
The stream to write the css to.
Exports an to a html string
A html table
Exports the css part of an to a html string
A html table
Renders a hyperlink
Exports an to a html string
A html table
Exports an to a html string
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
Exports an to a html string
The stream to write to
A html table
Exports an to a html string
The stream to write to
The index of the range to output.
Settings for this specific range index
A html table
Exports an to a html string
The stream to write to
Index of the range to export
Override some of the settings for this html exclusively
Renders both the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports an to a html string
A html table
Exports the html part of an to a html string.
The stream to write to.
Renders both the Css and the Html to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports an to a html string
A html table
Exports an to html and writes it to a stream
The stream to write to
Exports the css part of an to a html string
A html table
Exports the css part of an to a html string
A html table
Exports an to a html string
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
Exports an to a html string
The stream to write to
A html table
Exports the html part of the html export, without the styles.
The stream to write to.
The index of the range to output.
Settings for this specific range index
Exports the html part of the html export, without the styles.
The stream to write to.
Index of the range to export
Override some of the settings for this html exclusively
Renders the first range of the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports an to a html string
A html table
Exports the html part of an to a stream
A html table
Renders the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Public interface for the Html exporter
Settings for how to perform the html export
Exported ranges
Exports an to a html string
A html table
Exports an to a html string
0-based index of the requested range
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
Exports an to a html string
The stream to write to
A html table
Exports an to a html string
The stream to write to
The index of the range to output.
Settings for this specific range index
A html table
Exports an to a html string
The stream to write to
The index of the range to output.
Settings for this specific range index
A html table
Renders both the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports an to a html string
Cascading style sheet for the exported range
Exports the css part of the html export.
The stream to write the css to.
Exports an to a html string
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
A html table
Exports an to a html string
Index of the range to export
Override some of the settings for this html exclusively
Exports an to a html string
The stream to write to
A html table
Exports the html part of the html export, without the styles.
The stream to write to.
The index of the range to output.
Settings for this specific range index
Exports the html part of the html export, without the styles.
The stream to write to.
Index of the range to export
Override some of the settings for this html exclusively
Renders the first range of the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports the css part of an to a html string
A html table
Exports the css part of an to a html string
A html table
Exports an to html and css.
Settings for the html export
Exports an to a html string
A html table
Exports an to a html string
The stream to write to
A html table
Renders both the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports an to a html string
Cascading style sheet for the exported range
Exports the css part of the html export.
The stream to write the css to.
Exports an to a html string
A html table
Exports an to a html string
The stream to write to
A html table
Renders the first range of the Html and the Css to a single page.
The html string where to insert the html and the css. The Html will be inserted in string parameter {0} and the Css will be inserted in parameter {1}.
The html document
Exports the css part of an to a html string
A html table
Exports the css part of an to a html string
A html table
Css settings to exclude individual styles.
Exclude Font styles.
Exclude Border styles
Exclude Fill styles
Exclude vertical alignment.
Exclude horizontal alignment.
Exclude Wrap Text
Exclude Text Rotation
Exclude Indent.
Reset the settings to it's default values.
Copy the values from another settings object.
The object to copy.
Exclude css on an .
Css settings for table styles
Css settings for cell styles.
Base class for css export settings.
If set to true shared css classes used on table elements are included in the css.
If set to false, these classes has to be included manually. will be ignored if set to false and no font css will be added.
Default is true
If true the normal font will be included in the css. Default is true
Ensure margin and padding consistent between browsers
Css elements added to the table.
The value used in the stylesheet for an indentation in a cell
The unit used in the stylesheet for an indentation in a cell
Settings for css export for tables
Settings to exclude specific styles from the css.
Reset the settings to it's default values.
Copy the values from another settings object.
The object to copy.
Settings for css export for tables
Include Css for the current table style
Include Css for cell styling.
Exclude flags for styles
Reset the settings to it's default values.
Copy the values from another settings object.
The object to copy.
When exporting multiple ranges from the same workbook, this class can be used
to override certain properties of the settings.
Html id of the exported table.
Use this property to set additional class names that will be set on the exported html-table.
Settings for usage of accessibility (aria, role) attributes of the table
Number of header rows before the actual data. Default is 1.
If is 0, this collection contains the headers.
If this collection is empty the table will have no headers.
Settings for html export for tables
Css export settings.
Reset the settings to it's default values.
Copy the values from another settings object.
The object to copy.
Configure the settings.
Base class for HTML export for ranges and tables.
The html id attribute for the exported table. The id attribute is only added to the table if this property is not null or empty.
If set to true the rendered html will be formatted with indents and linebreaks.
How hidden rows will be handled. Default is
How to set the alignment for a cell if it's alignment is set to General.
Settings for usage of accessibility (aria, role) attributes of the table
Use this property to set additional class names that will be set on the exported html-table.
Use this property to set the name of the html data-* attribute that contains the raw value.
Default value is "value" which means that the name of the attribute is "data-value".
To change the name to "data-x", set this property to "x"
The culture used when formatting the cell output.
Encoding for the output
Set the column width for columns in the table via the columngroup/col element.
Columns with the default width will have the default column width class set, ({Settings.StyleClassPrefix}dcw).
Columns with custom column width will have the width set directly via the style attribute.
Set the row height for rows in the table.
Rows with the default height will have the default row height class set, ({Settings.StyleClassPrefix}drh).
Rows with custom row height will have the height set directly via the style attribute.
Prefix for style classes added by EPPlus.
typeClass name
- Cell styles{StyleClassPrefix}{CellStyleClassName}{index}
- Hidden Row{StyleClassPrefix}hidden
- Alignment Left {StyleClassPrefix}al
- Alignment Right{StyleClassPrefix}ar
- Default column width{StyleClassPrefix}dcw
- Default row height{StyleClassPrefix}drh
- Image content and position{StyleClassPrefix}image-{imageName}
- Properties for an image, for example position or border settings{StyleClassPrefix}image-prop-{imageName}
- Alignment for cells containing an image{StyleClassPrefix}image-cell}
The name of the classes used for cell styles.
The name will be prefixed with the and suffixed with the cell style index.
The name of the classes used for cell styles.
The name will be prefixed with the and suffixed with the cell style index.
The name of the classes used for cell styles.
The name will be prefixed with the and suffixed with the conditional formatting style index.
The name of the classes used for cell styles.
The name will be prefixed with the .
The name of the classes used to store icon images.
The name will be prefixed with the and suffixed with the icon name.
If picture drawings will be included. Default is true.
If set to true classes that identifies Excel table styling will be included in the html. Default value is true.
Set the target attribute for hyperlinks (a elements) in the exported html.
Can be null/empty (no target attribute), _blank, _top, _self, _parent or a frame-name.
If and how table styles should export, if the range is a table.
The range must be the same as the table range.
If true data-* attributes will be rendered
If true, data types are renedered on the header objects.
If true conditionalFormattings will be rendered
Setting for rendering of picture drawings
If picture drawings should be included in the html. Default is
If the image should be added as absolut or relative in the css.
If the margin in pixels from the top corner should be used.
If this property is set to true, the cells vertical alignment will be set to 'top',
otherwise alignment will be set to middle.
If the margin in pixels from the left corner should be used.
If this property is set to true, the cells text alignment will be set to 'left',
otherwise alignment will be set to center.
If set to true the original size of the image is used,
otherwise the size in the workbook is used. Default is false.
Exclude settings
Adds the Picture name as Id for the img element in the HTML.
Characters [A-Z][0-9]-_ are allowed. The first character allows [A-Z]_.
Other characters will be replaced with an hyphen (-).
Reset the setting to it's default values.
Copy the values from another settings object.
The object to copy.
Settings for html export for ranges
Number of header rows before the actual data. Default is 1.
If is 0, this collection contains the headers.
If this collection is empty the table will have no headers.
Options to exclude css elements
Reset the setting to it's default values.
Copy the values from another settings object.
The object to copy.
HTML Settings for excluding picture css settings.
Exclude image border CSS
Exclude image alignment CSS
Reset the setting to it's default values.
Copy the values from another settings object.
The object to copy.
Gets hexcode color for html as a string
For internal use
For internal use
For internal use
For internal use
For internal use
For internal use
Fill
Font
Border
Gets hexcode color for html as a string
Data convertion exception
Constructor
An object that represents a row in the callback function in
Headers used to access cell values.
The rows values
Returns the value of the row at the column index
the column index
Returns the value of the row at the column index
the column index
Returns the typed value of the cell at the column index within the row of the range.
The type to convert to
The column index
The value
Returned if the data type conversion fails and is set to Exception
Returns the typed value of the cell at the column index within the row of the range.
The type to convert to
The column name
The value
Returned if the data type conversion fails and is set to Exception
Returns formatted value of the cell at the column index within the row of the range.
The column index
The formatted value
Returns formatted value of the cell at the column index within the row of the range.
The column name
The formatted value
Maps properties on the item to values matching the column header with the property name or attibutes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type used, must be a class
The item to set the values on.
How conversion failures should be handled when mapping properties in the ToCollection method.
Throw an Exception if the conversion fails. Blank values will return the default value for the type. An will be thrown on any datatype conversion failure when mapping properties.
Set the default value for the property.
Class used to map columns in the method
The used for the mapping
Zero based index of the mappings column in the range
Name of the data column, corresponds to
Type of the column, corresponds to
Indicates whether empty cell values should be allowed. Corresponds to
A function which allows casting of an before it is written to the
var options = ToDataTableOptions.Create(o =>
{
// the last argument is a lambda function that will call the read value's ToString method
// and this string will be written to the DataTable
o.Mappings.Add(0, "Id", typeof(string), true, c => "Id: " + c.ToString());
});
A collection of s that will be used when reading data from the source range.
Adds a
Zero based index of the column in the source range
The destination in the
Adds a
Zero based index of the column in the source range
The destination in the
A function that casts/transforms the value before it is written to the
Adds a
Zero based index of the column in the source range
Name of the in the
Adds a
Zero based index of the column in the source range
Name of the in the
Indicates if values read from the source range can be null
Adds a
Zero based index of the column in the source range
Name of the in the
A function that casts/transforms the value before it is written to the
Adds a
Zero based index of the column in the source range
Name of the in the
of the
Adds a
Zero based index of the column in the source range
Name of the in the
of the
Indicates if values read from the source range can be null
Adds a
Zero based index of the column in the source range
Name of the in the
of the
Indicates if values read from the source range can be null
A function that casts/transforms the value before it is written to the
Defines how empty rows (all cells are blank) in the source range should be handled.
Ignore the empty row and continue with next
Stop reading when the first empty row occurs
Defines how cells with errors in the source range should be handled.
Excel Errors in cells will be handles as blank cells
An exception will be thrown when an error occurs in a cell
If an error is detected, the entire row will be ignored
Defines options for how to build a valid property or DataTable column name out of a string
Preserve the input string as it is
Replace any spaces with underscore
Remove all spaces
This class contains options for the ToDataTable method of .
Returns an instance of ToDataTableOptions with default values set. is set to , is set to false, is set to true
Creates an instance of ToDataTableOptions with default values set.
Creates an instance of . Use the parameter to set the values on it.
Use this to configure the instance in a lambda expression body.
The configured
If true, the first row of the range will be used to collect the column names of the . The column names will be set according to the used.
NameParsingStrategy to use when parsing the first row of the range to column names
Number of rows that will be skipped from the start (top) of the range. If is true, this will be applied after the first row (column names) has been read.
Number of rows that will be skipped from the end (bottom) of the range.
Sets how Excel error values are handled when detected.
Sets how empty rows in the range are handled when detected
Mappings that specifies columns from the range and how these should be mapped to the
If true, only columns that are specified in the collection are included in the DataTable.
If no column names are specified, this prefix will be used followed by a number
Name of the data table
Namespace of the data table
If true, the will be overridden and
null values will be allowed in all columns.
Set to true if the worksheet is contains transposed data.
Sets the primary key of the data table.
The name or names of one or more column in the that constitutes the primary key
Sets the primary key of the data table.
The index or indexes of one or more column in the range that builds up the primary key of the
How to handle a range when it is a table.
Do not set the table style css classes on the html table or create the table style css.
Set the css table style classes on the table, but do not include the table classes in the css.
Include the css table style for the table and set the corresponding classes on the html table.
How to set the data type when exporting json.
Do not set the data type.
Set the data type on the column level.
Set the data type on each cell.
Base class for settings used when exporting a range or a table as Json.
If the json is minified when written.
The name of the root element
Set the dataType attribute depending on the data. The attribute can be set per column or per cell.
The name of the element containing the columns data
The name of the element containg the rows data
The name of the element containg the cells data
Write the uri attribute if an hyperlink exists in a cell
Write the comment attribute if an comment exists in a cell.
Encoding for the output
The CulturInfo used when formatting values.
Set if data in worksheet is transposed.
Settings used when exporting a range to Json
The name of the root element
If the first row in the range is the column headers.
The columns array element will be added and the headers will be set using the Name attribute.
Set the dataType attribute depending on the data. The attribute can be set per column or per cell.
Settings used when exporting a table to Json
The name of the root element
Set the dataType attribute depending on the data. The attribute can be set per column or per cell.
If true the the column array element is written to the output
If true the table Name attribute is written to the output.
If true the ShowHeader attribute is written to the output.
If true the ShowTotals attribute is written to the output.
Settings for the ToCollection method.
Constructor
0-based index of the Header row in the range, if applicable.
A null value means there is no header row.
See also:
The data start row in the range.
A null value means the data rows starts direcly after the header row.
A with default values.
If the data is transposed or not
Base class for settings to the ToCollection method.
An array of column headers. If set, used instead of the header row.
Sets custom headers. If set, used instead of the header row.
How conversion failures should be handled when mapping properties.
Settings for the ToCollection method.
A with default values.
Clears all formulas leaving the value only for formulas containing external links
The type of DDE value.
The value is a boolean.
The value is an error.
The value is a real number.
The value is nil.
The value is a string.
The type of external link
The external link is of type
The external link is of type
The external link is of type
The status of an external workbooks cache.
Cache has not been updated. Saving an external reference with this status will update the cache on save.
Cache has been loaded from the external reference cache within the package.
Update of the cache failed. Any loaded data from the package is still available.
The cache has been successfully updated
A collection of
An indexer to access the the external cell values
The cell address
The
An indexer to access the the external cell values
The row of the cell to get the value from
The column of the cell to get the value from
The
The current value of the
The current value of the
Disposed the object
Get the enumerator for this collection
Move to the next item in the collection
true if more items exists
Resets the enumeration
Get the enumerator for this collection
Represents a cell value of an external worksheets cell.
The address of the cell
The row of the cell
The column of the cell
The value of the cell
A reference index to meta data for the cell
Represents a DDE link. This class is read-only.
The name of the DDE link item
If the linked object should notify the application when the external data changes.
If the linked object is represented by an image.
If this is item uses an ole technology.
A collection of DDE values
A collection of
Represents an external DDE link.
The type of external link
Service name for the DDE connection
Topic for DDE server.
A collection of
Represents a value for a DDE item.
The data type of the value
The value of the item
A collection of
The number of rows returned by the server for this dde item.
The number of columns returned by the server for this dde item.
Represents a defined name in an external workbook
The name
The address that the defined name referes to
The sheet id
The string representation of the name
Base class for external references
The type of external link
Provides an easy way to type cast the object to it's top level class
Returns the string representation of the object.
The index of the external link. The index can be used in formulas between brackets to reference this link.
worksheet.Cells["A1"].Formula="'[1]Sheet1'!A1"
A list of errors that occured during load or update of the external workbook.
Provides a simple way to type cast object top its top level class.
Converts the external link to it's top level .
The type of external link. T must be inherited from ExcelExternalLink
The external link as type T
Return the external link as an external workbook. If the external link is not of type , null is returned
Return the external link as a dde link. If the external link is not of type , null is returned
Return the external link as a ole link. If the external link is not of type , null is returned
A collection of external links referenced by the workbook.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Gets the number of items in the collection
The indexer for the collection
The index
Adds an external reference to another workbook.
The location of the external workbook. The external workbook must of type .xlsx, .xlsm or xlst
The object
Removes the external link at the zero-based index. If the external reference is an workbook any formula links are broken.
The zero-based index
Removes the external link from the package.If the external reference is an workbook any formula links are broken.
Clear all external links and break any formula links.
A list of directories to look for the external files that cannot be found on the path of the uri.
Will load all external workbooks that can be accessed via the file system.
External workbook referenced via other protocols must be loaded manually.
Returns false if any workbook fails to loaded otherwise true.
Updates the value cache for any external workbook in the collection. The link must be an workbook and of type xlsx, xlsm or xlst.
True if all updates succeeded, otherwise false. Any errors can be found on the External links.
A collection of cached defined names in an external workbook
Indexer for the collection
The name if the defined name
If the name exists in the collection
The name. Case insensitive
true if the name exists in the collection, otherwise false
Returns the index if the worksheet with the supplied name
The worksheet name
The index name if it exists. Otherwise -1
An OLE item in an external OLE link. Readonly.
If the linked object should notify the application when the external data changes.
If the linked object is represented by an image.
If the linked object is represented by an icon
The name of the OLE link item
A collection of
Represents an external DDE link.
The type of external link.
A collection of OLE items
The id for the connection. This is the ProgID of the OLE object
Represents an external workbook.
Sets the external link type
The Uri to the external workbook. This property will be set by the property on save, if it has been set.
If the external reference is a file in the filesystem
A reference to the external package, it it has been loaded.
Tries to Loads the external package using the External Uri into the property
True if the load succeeded, otherwise false. If false, see
Tries to Loads the external package using the External Uri into the property
True if the load succeeded, otherwise false. If false, see
Tries to Loads the external package using the External Uri into the property
True if the load succeeded, otherwise false. If false, see and of each
If true, sets the path to the workbook as a relative path on , if the link is on the same drive.
Otherwise set it as an absolute path. If set to false, the path will always be saved as an absolute path.
If the file path is relative and the file can not be found, the file path will not be updated.
Updates the external reference cache for the external workbook. To be used a must be loaded via the method.
True if the update was successful otherwise false
The status of the cache. If the method fails this status is set to
If cache status is set to NotUpdated, the cache will be updated when the package is saved.
String representation
A collection of cached defined names in the external workbook
A collection of cached worksheets in the external workbook
A representation of an external cached worksheet.
The sheet id
The name of the worksheet.
If errors have occured on the last update of the cached values.
A collection of cached names for an external worksheet
Cached cell values for the worksheet. Only cells referenced in the workbook are stored in the cache.
Returns a string that represents the current object.
A string that represents the current object.
A collection of external worksheets
The indexer to reference the external worksheet objects
The name of the worksheet
An interface for an external object that contains a name
The name
The calendar to be used.
The Gregorian calendar
The Gregorian calendar, as defined in ISO 8601. Arabic. This calendar should be localized into the appropriate language.
///
The Gregorian calendar, as defined in ISO 8601. Middle East French.
The Gregorian calendar, as defined in ISO 8601. English.
The Gregorian calendar, as defined in ISO 8601. English strings in the corresponding Arabic characters. The Arabic transliteration of the English for the Gregoriancalendar.
The Gregorian calendar, as defined in ISO 8601. French strings in the corresponding Arabic characters. The Arabic transliteration of the French for the Gregoriancalendar.
The Hijri lunar calendar, as described by the Kingdom of Saudi Arabia, Ministry of Islamic Affairs, Endowments, Da‘wah and Guidance
The Hebrew lunar calendar, as described by the Gauss formula for Passover [Har'El, Zvi] and The Complete Restatement of Oral Law(Mishneh Torah).
The Japanese Emperor Era calendar, as described by Japanese Industrial Standard JIS X 0301.
The Korean Tangun Era calendar, as described by Korean Law Enactment No. 4
No calendar
The Saka Era calendar, as described by the Calendar Reform Committee of India, as part of the Indian Ephemeris and Nautical Almanac
The Thai calendar, as defined by the Royal Decree of H.M. King Vajiravudh (Rama VI) in Royal Gazette B. E. 2456 (1913 A.D.) and by the decree of Prime Minister Phibunsongkhram (1941 A.D.) to start the year on the Gregorian January 1 and to map year zero to Gregorian year 543 B.C.
Date grouping for a filter
Group by day
Group by hour
Group by minute
Group by month
Group by second
Group by year
Dynamic filter types.
A dynamic filter returns a result set which might vary due to a change in the data itself.
Shows values that are above average.
Shows values that are below average.
Shows last month's dates.
Shows last calendar quarter's dates.
Shows last week's dates, using Sunday as the first weekday.
Shows last year's dates.
Shows the dates that are in January, regardless of year.
Shows the dates that are in February, regardless of year.
Shows the dates that are in March, regardless of year.
Shows the dates that are in April, regardless of year.
Shows the dates that are in May, regardless of year.
Shows the dates that are in June, regardless of year.
Shows the dates that are in July, regardless of year.
Shows the dates that are in August, regardless of year.
Shows the dates that are in September, regardless of
Shows the dates that are in October, regardless of year.
Shows the dates that are in November, regardless of year.
Shows the dates that are in December, regardless of year.
Shows next month's dates.
Shows next calendar quarter's dates.
Shows next week's dates, using Sunday as the firstweekday.
Shows next year's dates.
No filter
Shows the dates that are in the 1st calendar quarter, regardless of year.
Shows the dates that are in the 2nd calendar quarter, regardless of year.
Shows the dates that are in the 3rd calendar quarter, regardless of year.
Shows the dates that are in the 4th calendar quarter, regardless of year.
Shows this month's dates.
Shows this calendar quarter's dates.
Shows this week's dates, using Sunday as the first weekday.
Shows this year's dates.
Shows today's dates.
Shows tomorrow's dates.
Shows the dates between the beginning of the year and today, inclusive.
Shows yesterday's dates.
Operator used by the filter comparison
Show results which are equal to the criteria
Show results which are greater than the criteria
Show results which are greater than or equal to the criteria
Show results which are less than the criteria
Show results which are less than or equal to the criteria
Show results which are Not Equal to the criteria
Represents an Autofilter for a worksheet or a filter of a table
Applies the filter, hiding rows not matching the filter columns
If true, any formula in the autofilter range will be calculated before the filter is applied.
The range of the autofilter
Autofilter with address "" or null indicates empty autofilter.
The columns to filter
Clear all columns Unhide all affected cells, nullify address and table.
Represents a column filtered by colors.
Indicating whether or not to filter by the cell's fill color.
True filters by cell fill.
False filter by the cell's font color.
The differencial Style Id, referencing the DXF styles collection
Represents a custom filter column
If true filter is numeric otherwise it's textual.
If this property is not set, the value is set from the first value in column of the filtered range
Flag indicating whether the two criteria have an "and" relationship. true indicates "and", false indicates "or".
The filters to apply
A date group for filters
Filter out the specified year
The year
Filter out the specified year and month
The year
The month
Filter out the specified year, month and day
The year
The month
The day
Filter out the specified year, month, day and hour
The year
The month
The day
The hour
Filter out the specified year, month, day, hour and and minute
The year
The month
The day
The hour
The minute
Filter out the specified year, month, day, hour and and minute
The year
The month
The day
The hour
The minute
The second
The grouping. Is set depending on the selected constructor
Year to filter on
Month to filter on
Day to filter on
Hour to filter on
Minute to filter on
Second to filter on
Various filters that are set depending on the filter Type
Type of filter
The value of the filter. Can be the Average or minimum value depending on the type
The maximum value for for a daterange, for example ThisMonth
A collection of filters for a filter column
The filter type
A list of columns
Gets the enumerator for the collection
The enumerator
Gets the enumerator for the collection
The enumerator
The indexer for the collection
The index of the item
The item at the index.
Number of items in the collection
A collection of filters for a filter column
The filter type
Add a new filter item
Base class for filter columns
Gets the filter value
The value
Zero-based index indicating the AutoFilter column to which this filter information applies
If true the AutoFilter button for this column is hidden.
Should filtering interface elements on this cell be shown.
A collection of filter columns for an autofilter of table in a worksheet
Number of items in the collection
Indexer of filtercolumns
The column index starting from zero
A filter column
Adds a value filter for the specified column position
The column position
The value filter
Adds a custom filter for the specified column position
The column position
The custom filter
Adds a color filter for the specified column position
Note: EPPlus doesn't filter color filters when ApplyFilter is called.
The column position
The color filter
Adds a icon filter for the specified column position
Note: EPPlus doesn't filter icon filters when ApplyFilter is called.
The column position
The color filter
Adds a top10 filter for the specified column position
The column position
The top 10 filter
Adds a dynamic filter for the specified column position
The column position
The dynamic filter
Gets the enumerator of the collection
The enumerator
Gets the enumerator for the collection
The enumerator
Remove the filter column with the position from the collection
The index of the column to remove
Remove the filter column from the collection
The column
Clear all columns
A custom filter item
Create a Custom filter.
The value to filter by.
If the data is text wildcard can be used.
Asterisk (*) for any combination of characters.
Question mark (?) for any single charcter
If the data is numeric, use dot (.) for decimal.
The operator to use
Operator used by the filter comparison
Base class for filter items
A filter item for a value filter
Inizialize the filter item
The value to be filtered.
A value to be filtered.
A filter column filtered by icons
Note that EPPlus does not filter icon columns
The icon Id within the icon set
The Iconset to filter by
A filter column filtered by the top or botton values of an range
The filter value to relate to
If the filter value is an percentage
True is top value. False is bottom values.
The value to filter on
A collection of value filters
Flag indicating whether to filter by blank
The calendar to be used. To be implemented
Add a Date filter item.
Add a filter value that will be matched agains the ExcelRange.String property
If value is "" or null sets Blank=True instead of adding.
The value to add. If "" or null sets Blank=True instead.
The filter value item
Add a filter value that will be matched agains the ExcelRange.Text property
If value is "" or null sets Blank=True instead of adding.
The value to add. If "" or null sets Blank=True instead.
The filter value item
Clears the collection
Remove the item at the specified index from the list
The index in the list
Remove the item from the list
The item to remove
Represents a value filter column
The filters applied to the columns
A collection of fonts and there size in pixels used when determining auto widths for columns.
This is used as .NET and Excel does not measure font widths in pixels in a similar way.
Default font used in EPPlus
Font used in EPPlus if the font name supplied cannot be found
Dictionary containing Font Width in pixels.
You can add your own fonts and sizes here.
Dictionary containing default Font Heights in pixels for the row height calculates.
You can add your own fonts and sizes here.
Get the font info for either height or width
The font name
If true, FontWidth is used, else FontHeights
Load the fonts default heights/widths from the internal resource file
Load the specified fonts default heights/widths from the internal resource file
The name of the font.
If false the stream is loading the font is kept open to load other fonts faster. It true the font-stream is disposed on exit.
Extentions methods for formula calculation.
Calculate all formulas in the current workbook
The workbook
Calculate all formulas in the current workbook
The workbook to calculate
Configuration handler
workbook.Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);
Calculate all formulas in the current workbook
The workbook
Calculation options
Calculate all formulas in the current worksheet
The worksheet
Calculate all formulas in the current range
The worksheet to calculate
Configuration handler
sheet.Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);
Calculate all formulas in the current worksheet
The worksheet
Calculation options
Calculate all formulas in the current range
The range
Calculate all formulas in the current range
The range to calculate
Configuration handler
sheet.Cells["A1:A3"].Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);
Calculate all formulas in the current range
The range
Calculation options
Calculate all formulas in the current range
The worksheet
The formula to be calculated
The result of the formula calculation
Calculate all formulas in the current range
The worksheet
The formula to be calculated
Calculation options
The result of the formula calculation
NOTE: This is the position in the ExcelWorksheets._worksheets collection. Cannot be used direcly with Worksheets[] indexer.
Used in the formula calculation dependency chain
The name of the worksheet.
The address of the formula
The formula
Represents a formula cell
The worksheet
The address
The formula
EPPlus implementation of the ExcelDataProvider abstract class.
Gets a IName
Caches string by generated id's.
Returns an id to use for caching (when the method is called)
Adds an address to the cache
Number of items in the cache
Returns an address by its cache id
Clears the cache
Options used by the formula parser
Constructor
Do not throw an exception if the formula parser encounters a circular reference
Expressions in the formula calculation will be cached, to be resused.
This increases speed, if having multiple formulas using the same expressions.
Canching increases memory consumtion on calculate.
In some functions EPPlus will round double values to 15 significant figures before the value is handled. This is an option for Excel compatibility.
If true, EPPlus will calculate the cells in order calculating any dependent cells.
If false, EPPlus will calculate the cells without calculating dependent cells.
This class should be implemented to be able to deliver excel data
to the formula parser.
Returns the names of the worksheets in a workbook
Returns the names of all worksheet names
Returns the names of all worksheet names
Returns the number of a worksheet in the workbook
Name of the worksheet
The number within the workbook
Returns all defined names in a workbook
Returns values from the required range.
The name of the worksheet
Row
Column
The reference address
Returns values from the required range.
The name of the worksheet
The reference address
Returns a single cell value
Creates a cell id, representing the full address of a cell.
The worksheet index
Row ix
Column Index
An representing the addrss
Returns the address of the lowest rightmost cell on the worksheet.
Use this method to free unmanaged resources.
Max number of columns in a worksheet that the Excel data provider can handle.
Max number of rows in a worksheet that the Excel data provider can handle
Handles translations from Spreadsheet addresses to 0-based numeric index.
Translates an address in format "A1" to col- and rowindex.
If the supplied address is a range, the address of the first part will be calculated.
Translates an address in format "A1" to col- and rowindex.
Information about an address.
Parse address into a new addressinfo
Adress to parse
The worksheet name
Returns true if the is set
If the address reference multiple cells.
The start cell address
The end cell address
The address part if a worksheet is specified on the address.
Utilites tp verify addresses and reöated tokens
Ensure address and sheet has valid names
Wether or not the address is valid
Returns true if a defined name is valid
Ensures valid name by removing invalid chars and replacing them with '_'
Reference types for if an adress/cell is absolute or relative and in what way
Both Row and column are absolute
Absolute row and relative column
Realtive row absolute column
Relative row and relative column
Returns true if any of the supplied expressions evaluates to true
The object to evaluate
The expressions to evaluate the object against
True if any of the supplied expressions evaluates to true
Returns true if the supplied expression evaluates to true
The object to evaluate
The expressions to evaluate the object against
Returns true if the supplied expression evaluates to true
The object to evaluate
The expressions to evaluate the object against
If true and is a numeric string it will be converted to a number
Compares values for lookup
Compares object to string. Incomplete.
object 1
object 2
Adress over a range
Constructor for empty address
Worksheet
From Column
To Column
From row
To row
To string
Empty
Returns true if this range collides (full or partly) with the supplied range
The range to check
Create
The worksheet index.
address of a range
returns a list of nullable doubles based on the supplied range.
both dates and numeric values will be included.
Produces two lists based on the supplied ranges. The lists will contain all data from positions where both ranges has numeric values.
range 1
range 2
a list containing all numeric values from that has a corresponding value in
a list containing all numeric values from that has a corresponding value in
Compares and matches values
Value to represent incompatible operands
Compares objects of different types using appropriate CompareTo methods
original value
potential match
If true a numeric string will be convered to a number in the comparison. Default value is true.
Compares strings
Compares string to object candidate
Compares object to string candidate.
Compares values against wildcard strings
Compares two strings
The searched value, might contain wildcard characters
The candidate to compare
0 if match, otherwise -1 or 1
Compares values against wildcard strings
Compares two strings
The searched value, might contain wildcard characters
The candidate to compare
0 if match, otherwise -1 or 1
The state of a cell
The cell is hidden
The cell contains a cell error
The cell contains a result of a subtotal function.
Simplifies function argument input by collecting and enumerating arguments of different types
Empty constructor
Constructor with converters
Converts args to enumerable ExcelDoubleCellValue
Converts args to enumerable objects with an aggregate
Converts args to enumerable objects
Argument parser base abstract class
Parse object argument
Parse object argument and round it
Parser factory for
Create argument parser for datatypes , and
Argument parsers
Empty constructor
Factory constructor.
Factory cannot be null
Get parser of type
This class should be used to configure how arrays/ranges are treated as parameters to functions
that can return a dynamic array.
This method sets indexes of arguments that can be an array.
A list of integers that specifies the 0-based index of arguments that can be an array.
Use this property in combination with . A typical scenario would be that
the first 3 arguments should be ignore and then every 3rd argument might be in array. In this scenario this
property should be set to 3.
Indicates that every x-th argument can be an array.
Returns true if the 0-based index
occurs in the list or if
the index matches the configuration of
and .
argument index (0-based)
Boolean argument parser
Parse object to bool
Parse object to bool with rounding method
Built-in functions Epplus provides. As opposed to custom functions made by the user.
Flattens arguments to enumerable
Args to enumerables of type
Validates Excel function compile results
Validate object
Supply or create empty compile result validator
Validator collections
Get validator of type
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
Field for database criteria
Constructor with field name
Constructor with field index
return name or object toString
Name of field
Index of field
Database field
Name of field
Column index
Constructor
Database row
Get object at field
Fetch field from indexes then return that field from within the row
Simple implementation of DateValue function, just using .NET built-in
function System.DateTime.TryParse, based on current culture
This implementation was found on http://stackoverflow.com/questions/1285191/get-week-of-date-from-linq-query
If the function is allowed in a pivot table calculated field
Simple implementation of TimeValue function, just using .NET built-in
function System.DateTime.TryParse, based on current culture
If the function is allowed in a pivot table calculated field
Defining additional holidays for datetime functions
Function argument for adding a holiday
DateTime enumerable for additional holidays
Holiday weekdays for datetime functions
Empty constuctor. Sets saturday and sunday to holiday days automatically.
Defined as 7 - number of holidayDays
Define holiday weekdays by input array
Check wether given datetime is a holidayWeekday or not
Adjust result with holidays.
Gets the next datetime workday
Factory class for holidayWeekdays
Create from string
Create from code
Whether to look for weekday forwards or backwards
Forward direction
Backward direction
Workday calculator result
Constructor. Calculate workdays
Number of Workdays
Start date
End date
Direction to look for workdays in
Validation for decimal function results
Validate that decimal is not NaN or infinity
Parse double
Attempts to parse object to double. Throws value error on exception
Shorthand for Parse
Enumerable to double
Convert args to enumerable
Convert args including range info, doubles, ints, bools and strings
Options for parsing function arguments to a list of doubles
Ignore errors in cells
Ignore hidden cells
Ignore results from underlying SUBTOTAL or AGGREGATE functions
Ignore cells with non-numeric values
This static class contains all the setup, definitions and methods needed for Excel's Convert function
Types of mapping groups
A mapping definition
Represents a prefix and its value, such as the k in km (kilo-meters).
Convert function
Minimum arguments
Execute convert function
Returns error function
Min arguments
Execute Erf
Creates a string that represents an imaginary number.
The real part of the number
The imaginary part of the number
The sign used in the number
Suffix (i or j)
A string that represents an imaginary number.
Bessel base
f_PI
f_Pi divided by 2
f_PI divided by four
Two divided by f_PI
Bessel I Implementation
Bessel I
Bessel J
Bessel J
Bessel K
@throws IllegalArgumentException
@throws NoConvergenceException
Bessel K
Bessel Y Implementation
@throws IllegalArgumentException
@throws NoConvergenceException
Bessel Y
Double as cell value
Constructor value only
Constructor value row and column
Row
Col
Value
return value
User-defined conversion from double to Digit
Compare to other doubleCellValue
Compare to object
Is this equivalent to object
Get hash code
Equals operator ExcelDoubleCellValues
Equals operator ExcelDoubleCellValue and double
Unequal operator ExcelDoubleCellValues
Unequal operator ExcelDoubleCellValue and double
Base class for Excel function implementations.
Default constructor
Constructor
Number of significant figures used in roundings, etc.
Configuration for paramenters that can be an array. See
Arguments to the function, each argument can contain primitive types, lists or Excel ranges
The contains various data that can be useful in functions.
A containing the calculated value
Returns the minimum arguments for the function. Number of arguments are validated before calling the execute. If lesser arguments are supplied a #VALUE! error will be returned.
If overridden, this method will be called before the method is called with the arguments for any parameter having
set to and that argument is a range with an address.
It can be used to narrow the dependency check for the function returning a queue with addresses to check dependency before executing.
The function arguments that will be supplied to the execute method.
The index of the argument that should be adjusted.
A queue of addresses that will be calculated before calling the Execute function.
Indicates that the function is an ErrorHandlingFunction.
Describes how the function works with input ranges and returning arrays.
Configures parameters of a function that can be arrays (multi-cell ranges)
even if the function itself treats them as single values.
Indicates whether the function handles variables (eg. LET, LAMBDA).
Used for some Lookupfunctions to indicate that function arguments should
not be compiled before the function is called.
This functions validates that the supplied contains at least
(the value of) elements. If one of the arguments is an
Excel range the number of cells in
that range will be counted as well.
The of the that will be thrown if is not met.
This functions validates that the supplied contains at least
(the value of) elements. If one of the arguments is an
Excel range the number of cells in
that range will be counted as well.
Returns a string representation of an arguments address.
Returns the value of the argument att the position of the 0-based index
as an integer.
If an error occurs during the conversion it will be returned via this parameter
Value returned if datatype is empty
Value of the argument as an integer.
Returns the value of the argument att the position of the 0-based index
If true an Excel error in the cell will be ignored
If an error occurs during the conversion it will be returned via this parameter
Value of the argument as an integer.
///
Returns the value of the argument att the position of the 0-based
as an integer.
Value of the argument as an integer.
Returns the value of the argument att the position of the 0-based
as a string.
Value of the argument as a string.
Returns the value of the argument att the position of the 0-based
Will be set if the conversion generated an error
Value of the argument as a double.
Returns the value of the argument att the position of the 0-based
strategy for handling precision and rounding of double values
An error type if the operation returns an error.
Value of the argument as a double.
Returns the value of the argument att the position of the 0-based
as a .
strategy for handling precision and rounding of double values
Will be set if an error occurs during conversion
Value of the argument as an integer.
Returns the value of the argument att the position of the 0-based
as a .
If the the value is null, zero will be returned.
Will be set if an error occurs during conversion
Value of the argument as an integer.
Returns the value as if the
Divides two numbers. If is zero double.PositiveInfinity will be returned.
Numerator
Denominator
Returns true if the parameter is a numeric string, otherwise false.
The value to test
Returns true if the parameter is an integer, otherwise false.
The value to test
If the argument is a boolean value its value will be returned.
If the argument is an integer value, true will be returned if its
value is not 0, otherwise false.
If the argument is a boolean value its value will be returned.
If the argument is an integer value, true will be returned if its
value is not 0, otherwise false.
fallback to ValueIfEmpty if datatype is empty
Throws an if evaluates to true.
Throws an if evaluates to true.
Formats to the message string.
Throws an with the given set.
Throws an with the type of given set.
Throws an if evaluates to true.
Is numeric
Is bool
Is string
Helper method for comparison of two doubles.
Will return the arguments as an enumerable of doubles.
Will return the arguments as an enumerable of doubles.
Will return the arguments as an enumerable of doubles.
Will return the arguments as an enumerable of doubles using default parameters
Will return the arguments as an enumerable of objects.
If a cell is hidden and this value is true the value of that cell will be ignored
Use this method to create a result to return from Excel functions.
Use this method to create a result to return from Excel functions.
Use this method to create a result to return from Excel functions.
Use this method to create a result to return from Excel functions.
Use this method to create a result to return from Excel functions.
Use this method to create a result to return from Excel functions.
if the supplied argument contains an Excel error
an with that errorcode will be thrown
If the cell contains an error the error will be assigned to this variable
If the supplied contains an Excel error
an with that errorcode will be thrown
If the cell contains an error the error will be assigned to this variable
Get result by object
If the function returns a different value with the same parameters.
If the function returns a range reference
If the function is allowed in a pivot table calculated field. Default is true, if not overridden.
Provides information about the functions parameters.
Information of individual arguments of the function used internally by the formula parser .
Function argument information
Used to indicate if a function can return an array of values.
The function does not support arrays
The function supports arrays, but not according to any of the options in this enum. If a function returns this value
it should also implement the function.
The function supports arrays and the first argument could be a range.
Function parameters info
Default
Constructor getParameter
Has normal arguments
Get information about the parameter at the position at
The position of the parameter
The parameter informations
Day counting options unsed in the internal finance function implementations.
US basis
Actual actual
Actual 360
Actual 365
Europe
Number of days between two s
The other day
Number of days according to the of this day
Rules as defined on https://en.wikipedia.org/wiki/Day_count_convention
The Excel FV function calculates the Future Value of an investment with periodic constant payments and a constant interest rate.
The interest rate, per period.
The number of periods for the lifetime of the annuity.
An optional argument that specifies the payment per period.
An optional argument that specifies the present value of the annuity - i.e. the amount that a series of future payments is worth now.
An optional argument that defines whether the payment is made at the start or the end of the period.
Calculates the present value
The interest rate, per period.
The number of periods for the lifetime of the annuity or investment.
An optional argument that specifies the payment per period.
An optional argument that specifies the future value of the annuity, at the end of nper payments.If the[fv] argument is omitted, it takes on the default value 0.
An optional argument that defines whether the payment is made at the start or the end of the period. See
The Excel NPV function calculates the Net Present Value of an investment, based on a supplied discount rate, and a series of future payments and income.
The discount rate over one period.
Numeric values, representing a series of regular payments and income
Finance Calculation Result
Constructor result
Constructor result and datatype
Error constructor
Result
DataType
Has error
Error type
ICouponProvider
GetCoupdaybs
CoupDays
Coupdaysnc
GetCoupsncd
GetCoupnum
GetCouppcd
IPmtProvider
GetPmt
IPriceProvider
GetPrice
IYearFracProvider
GetYearFrac
NPer Implementation
NPer
PmtDue
End of period
Beginning of period
Rate implementation
Rate
LEvalRate
Xirr implementation
Get Xirr
IFvProvider
GetFv
Represents a function argument passed to the Execute method of a class.
Constructor.
The value of the function argument.
Constructor.
The value of the function argument.
The data type of the . The data type should match the values .NET data type
If the compile result has a function that handles hidden cells.
The value of the function argument
The data type of the .
The address for function parameter
If the is a range with more than one cell.
If the is a range.
Returns true if the is an
Tries to parse as
If is an instance of or has set to a valid address
this property will return a . If not null will be returned.
If the value is a the value will return the value of the first cell, otherwise the will be returned.
If the value is a the value will return the value of the first cell, otherwise the will be returned.
Function name provider
Empty
Is function name
Information about an argument passed to a function used in the formula parser.
The argument will be handled as a normally.
If the argument is an address this address will be ignored in the dependency chain.
This argument is a condition returning a boolean expression
Use this argument if the condtion is true. Requires a previous parameter to be
Use this argument if the condtion is false. Requires a previous parameter to be
By default errors found in parameters are returned as a compile result containing the error before calling the method.
Setting this value will allow the function to receive the error as an argument and process them.
If the parameter is an address, call the to adjust the address before dependency check.
The parameter is a variable which value is calculated by the next parameter.
This class provides methods for accessing/modifying VBA Functions.
Create repository
Loads a module of s to the function repository.
A that can be used for adding functions and custom function compilers.
Get function
Removes all functions from the repository
Returns true if the the supplied exists in the repository.
Returns the names of all implemented functions.
Adds or replaces a function.
Case-insensitive name of the function that should be added or replaced.
An implementation of an .
Contains all functions that needs a namespace prefix in Excel.
For example: The Filter function must have the prefix "_xlfn._xlws."
Base class
Gets a dictionary of custom function implementations.
Gets a dictionary of custom function compilers. A function compiler is not
necessary for a custom function, unless the default expression evaluation is not
sufficient for the implementation of the custom function. When a FunctionCompiler instance
is created, it should be given a reference to the same function instance that exists
in the Functions collection of this module.
Returns the inverse of the incomplete beta function
Evaluates the continued fraction for incomplete beta function by modified Lentz's method.
Evaluates the continued fraction at the value x
The constant value of radic;(2pi;).
The constant {@code A0} defined in {@code DGAM1}.
The constant {@code A1} defined in {@code DGAM1}.
The constant {@code B1} defined in {@code DGAM1}.
The constant {@code B2} defined in {@code DGAM1}.
The constant {@code B3} defined in {@code DGAM1}.
The constant {@code B4} defined in {@code DGAM1}.
The constant {@code B5} defined in {@code DGAM1}.
The constant {@code B6} defined in {@code DGAM1}.
The constant {@code B7} defined in {@code DGAM1}.
The constant {@code B8} defined in {@code DGAM1}.
The constant {@code P0} defined in {@code DGAM1}.
The constant {@code P1} defined in {@code DGAM1}.
The constant {@code P2} defined in {@code DGAM1}.
The constant {@code P3} defined in {@code DGAM1}.
The constant {@code P4} defined in {@code DGAM1}.
The constant {@code P5} defined in {@code DGAM1}.
The constant {@code P6} defined in {@code DGAM1}.
The constant {@code Q1} defined in {@code DGAM1}.
The constant {@code Q2} defined in {@code DGAM1}.
The constant {@code Q3} defined in {@code DGAM1}.
The constant {@code Q4} defined in {@code DGAM1}.
The constant {@code C} defined in {@code DGAM1}.
The constant {@code C0} defined in {@code DGAM1}.
The constant {@code C1} defined in {@code DGAM1}.
The constant {@code C2} defined in {@code DGAM1}.
The constant {@code C3} defined in {@code DGAM1}.
The constant {@code C4} defined in {@code DGAM1}.
The constant {@code C5} defined in {@code DGAM1}.
The constant {@code C6} defined in {@code DGAM1}.
The constant {@code C7} defined in {@code DGAM1}.
The constant {@code C8} defined in {@code DGAM1}.
The constant {@code C9} defined in {@code DGAM1}.
The constant {@code C10} defined in {@code DGAM1}.
The constant {@code C11} defined in {@code DGAM1}.
The constant {@code C12} defined in {@code DGAM1}.
The constant {@code C13} defined in {@code DGAM1}.
Returns the value of Γ(x). Based on the NSWC Library of
Mathematics Subroutines double precision implementation,
{@code DGAMMA}.
@param x Argument.
@return the value of {@code Gamma(x)}.
The following function is ported from the jstat library licensed under the MIT license.
See https://github.com/jstat/jstat/blob/1.x/src/distribution.js
The following function is ported from the jstat library licensed under the MIT license.
See https://github.com/jstat/jstat/blob/1.x/src/distribution.js
Base class for functions that needs to handle cells that is not visible.
Hidden values handling function
Set to true or false to indicate whether the function should ignore hidden values.
Set to true to indicate whether the function should ignore error values
Set to true to indicate whether the function should ignore nested SUBTOTAL and AGGREGATE functions
Args to double enumerable
Should Ignore
Should ignore with argument
Function module
Gets a dictionary of custom function implementations.
Function name provider
Is function name
Reference Parameters do not need to be follows in the dependency chain.
If the function is allowed in a pivot table calculated field
Int argument parser
Parse object to int
Parse object to int roundingMethod
If the function is allowed in a pivot table calculated field
Ifs with multiple matches
Get matches
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
Thanks to the guys in this thread: http://stackoverflow.com/questions/2840798/c-sharp-math-class-question
Range or value
Value
Range
Rank functions rounds towards zero, i.e. 0.41666666 should be rounded to 0.4166 if 4 decimals.
The number to round
Number of siginicant digits
Count the number of digits left of the decimal point
Categories for functions
Text
Information
LookupAndReference
Statistical
Financial
Cube
Logical
DateAndTime
ManthAndTrig
Database
Engineering
Web
Attribute used for Excel formula functions metadata.
Function category
EPPlus version where the function was introduced
Short description of the function.
A string describing in which Excel version the function was introduced.
Returns true if the function can return an array if called with a multicell range as the argument.
Object Enumerable arg converter
Convert args to enumerable
Convert args to enumerable
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
Gets the Criterias for the row/column field from the normal argument syntax
The arguments to the GetPivotData
The compiled result
Gets the Criterias a string. This syntax is used when a row/column field has its own subtotals.
In this case the first parameter is the address to the pivot table and the second parameter is a string containing all information regarding criteria and which function is used.
Syntax 'Field Name'['Field Value',Function]. If the value is not the first row/column field values are space separated before and after. Example =GETPIVOTDATA($B$2;"Australia Sindey 'Years (InvoiceDate)'['2022',Count] '9232'") .
The arguments to the GetPivotData
The compiled result
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
Reference Parameters do not need to be follows in the dependency chain.
If the function is allowed in a pivot table calculated field
Reference Parameters do not need to be follows in the dependency chain.
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
If the function is allowed in a pivot table calculated field
Reference Parameters do not need to be follows in the dependency chain.
Rounding method
Round decimal number to int using Convert.ToInt32
Round decimal number to int using Math.Floor
The Text
Minimum arguments
Execute function
This enum is used to indicate how a function
handles hidden cells.
Used to indicate that the function has the default behaviour
The function has the SUBTOTAL behaviour
The function has the AGGREGATE behaviour
Operator interface
Operator
Apply
Precedence
Implements the KahanSum algorithm to reduce floating point errors.
Implementation of operators in formula calculation.
Apply
Operator plus
Minus operator
Multiply
Divide
Exp
Concat
Colon
Intersect operator
Greater than operator
Equals operator
Not equals to
Greater than or equal
Less than
Less than or equal
Operator enum
Undefined
Concat
Plus
Minus
Multiply
Divide
Modulus
Percent
Equals
Greater than
Greater than or equal
Less than
Less than or equal
Not equal to
Integer division
Exponentiation
Colon
Intersect
Limited operators
Equals
Greater than
Greater than or equal
Less than
Less than or equal
Not equal to
Operators dictionary
Constructor
Instance of the OperatorsDict
Operators enum dict
Constructor
Instance of the OperatorsDict
Represents a circular reference errors that occur during formula calculation.
Initializes a new instance of the CircularReferenceException
The message that describes the error
Represents an Excel error code.
The error code
Returns the hash code for this string.
The hash code
Determines whether the specified object is equal to the current object.
The object to compare with the current object.
true if the specified object is equal to the current object; otherwise, false.
Equal operator
The first error code to match
The second error code to match
Not equal operator
The first error code to match
The second error code to match
Returns true if matches an error code.
Represents a cell value error
Represents a cell name error
Reprecents a N/A error
This Exception represents an Excel error. When this exception is thrown
from an Excel function, the ErrorValue code will be set as the value of the
parsed cell.
Constructor
The error value causing the exception
Constructor
The error value causing the exception
An error message for the exception
Constructor
The error type causing the exception
The error value
Invalid formula exception
Invalid formula exception
Invalid formula exception inner exception
Unrecognized token exception
Constructor. Token exception
Tje token that can not be recognized
This class contains information of the usage of Filters on the worksheets of a workbook.
One area where this information is needed is when running the SUBTOTAL function. If
there is an active filter on the worksheet hidden cells should be ignored even if SUBTOTAL
is called with a single digit func num.
Returns true if there is an Autofilter with at least one column on the requested worksheet.
Worksheet index
Result type
A normal compile result containing a value.
A compile result referencing a range address. This will allow the result to be used with the colon operator.
The result is a dynamic array formula.
The result is a dynamic array formula. Even if the result is nested in another function that the cell should be marked as dynamic.
CompileResultBase
Result type
Compile result
Returns a CompileResult with a null value and data type set to DataType.Empty
Returns a CompileResult instance with a decimal value of 0.
Returns a CompileResult instance with a integer value of 0.
Returns a CompileResult instance with a boolean value of false.
Returns a CompileResult instance with a boolean value of true.
Constructor
The result.
The data type of the result.
Returns a from the error type/>
The type of error.
The with a the value containing the for the type.
Compile result with error type
Compile result with error value
RESULT
Result Value
Result numeric
Data type
Is the result numeric
Is result numeric string
Is percentage string
Is date string
Is result of subtotal
Is hidden cell
Is result of resolved excelRange
Range address
Result type
Address compile result
Address result
Address result without address
Address compile result
Address
ResultType
Indicates that the result the function should be created as a dynamic array result.
Constructor
Constructor
Constructor
Constructor
Constructor
The result is a dynamic array.
Represents a value's data type in the formula parser.
An integer
A decimal or floating point
A string
A boolean
A date or date/time
A time
An address range, e.g A1:B2
An error code
Null or empty string
An unknown data type
Variable data type
This expression represents a literal array where rows and cols are separated with comma and semicolon.
Compiles the expression into a
Function compiler
Function
Function compiler
The function
Build function arguments
Build Function Arguments
Compile
This class represents a range that contains more than one address, where the ranges are separated by a comma.
Entry class for the formula calulation engine of EPPlus.
Constructor
The package to calculate
Constructor
An instance of which provides access to a workbook
The package to calculate
Constructor
An
Parsing context
This method enables configuration of the formula parser.
An instance of the
Contains information about filters on a workbook's worksheets.
Parse with option to not write result to cell but only return it
True if write result to cell false if not
Parses a formula at a specific address
A string containing the formula
Address of the formula
Calculation options
Parses a formula
A string containing the formula
The result of the calculation
Parses a formula in a specific location
address of the cell to calculate
The result of the calculation
Parses a formula in a specific location
Name of the worksheet
Row in the worksheet
Column in the worksheet
The result of the calculation
An for logging during calculation
Implementation of
Provides access to various functionality regarding
excel formula evaluation.
Loads a module containing custom functions to the formula parser. By using
this method you can add your own implementations of Excel functions, by
implementing a .
A containing s.
If the supplied does not exist, the supplied
implementation will be added to the formula parser.
If it exists, the existing function will be replaced by the supplied function implementation
Copies existing ´s from one workbook to another.
The workbook containing the forumulas to be copied.
Returns an enumeration of the names of all functions implemented, both the built in functions
and functions added using the LoadFunctionModule method of this class.
Function names in lower case
Returns an enumeration of all implemented functions, including the implementing instance.
An enumeration of , where the key is the function name
Parses the supplied and returns the result.
The formula to parse
The result of the parsed formula
Parses the supplied and returns the result.
The formula to parse
The full address in the workbook where the should be parsed. Example: you might want to parse the formula of a conditional format, then this should be the address of the cell where the conditional format resides.
If writing result to adress or not, true by default
The result of the parsed formula
Attaches a logger to the .
An instance of
Attaches a logger to the formula parser that produces output to the supplied logfile.
Detaches any attached logger from the formula parser.
Get calculation chain
Get Calculation chain
Information and help methods about a cell
Address
WorksheetName
Row
Column
Id
Formula
Value
Value double
Value double logical
Is hidden row
Is excel error
Tokens
NameInfo
Id
wsIx
Name
Formula
Value
IsRelative
Get relative formula
Get relative range
Get value
Name value provider
Is named value
Get named value
GetNamedValue
Reload
Information about a specific range used by the formula parser.
If the range is empty
If the range contains more than one cell with a value.
If the range is not valid and returns #REF!
Returns true if the range is not referring to the cell store, but rather keeps the data in memory.
Get number of cells
Number of cells
Size of the range, i.e. number of Cols and number of Rows
Get the value from a cell
The Row
The Column
Gets
Get a subrange
row start index from top left
col start index from top left
row end index from top left
col end index from top left
A new range with the requested cell data
Returns true if the cell is hidden
The worksheet
The worksheet dimension if the range referres to an worksheet address, otherwise the size of the array.
Address info
The address.
If the address contains commaseparated addresses, this array contains the individual addresses.
Return all addresses in the formula.
Return tokens with addresses concatenated into an ExcelAddress instead of cell
Formula Cell address
Constructor cell address
Worksheet index in the package.
-1 - Non-existing worksheet
int.MinValue - Not set.
The row number
The column number
The address
The cell id for the address.
The cell Id is an ulong with the worksheet shifted as ((ushort)sheetId) | (((ulong)col) << 16) | (((ulong)row) << 30)
Formula address base
External reference index.
-1 means the current workbook.
short.MinValue - Invalid reference.
Worksheet index in the package.
-1 - Non-existing worksheet
short.MinValue - Not set.
Represents a range address
Constructor
Constructor
Constructor
Formula range address
Formula range address
From row and column. To row and to column
From row and column. To row and to column
From row and column. To row and to column
From row and column. To row and to column
Is single cell
Empty
ToString() returns the full address as a string
Address of the range on the worksheet (i.e. worksheet name is excluded).
Worksheet name of the address
Returns this address as a
Compare to
Clone
Address
If the address contains multiple comma separated addresses, the individual addresses are stored here.
Formula table address
Formula table address constructor
Constructor
Names
Names
Names
Names
Names
Clones the table address.
Interface lexer
Tokenize
Tokenize
Source code tokenizer
Tokenize
Tokenize
Source code tokenizer
The default tokenizer. This tokenizer will remove and ignore whitespaces.
The tokenizer used for r1c1 format. This tokenizer will keep whitespaces and add them as tokens.
The default tokenizer. This tokenizer will remove and ignore whitespaces.
A function name provider
A name value provider
If true the tokenizer will use the R1C1 format
If true whitspaces in formulas will be preserved
If the formula is from a calculated column in a pivot table.
Split the input string into tokens used by the formula parser
Splits a formula in tokens used in when calculating for example a worksheet cell, defined name or a pivot table field formula.
The formula to tokenize
The worksheet name.
Thrown if the formula is not valid.
Represents a character in a formula
Constructor
The formula character
The
Constructor
The formula character
The
The formula character
Indicates whether a numeric value should be negated when compiled
Operator ==
Operator !=
Overrides object.Equals with no behavioural change
Overrides object.GetHashCode with no behavioural change
Return if the supplied is set on this token.
The to check
True if the token is set, otherwirse false
Returns true if the token contains a address token that should be updated in insert/delete operations.
Returns true if the token is a token building an address.
Are equal to
Clones the token with a new set.
The new TokenType
A cloned Token
Clones the token with a new value set.
The new value
A cloned Token
Clones the token with a new value set for isNegated.
The new isNegated value
A cloned Token
Overrides object.ToString()
TokenType, followed by value
Token types in the context of formula parsing.
The parsed token represents an operator
The parsed token represents an negator (negates a numeric expression)
The parsed token represents an opening parenthesis
The parsed token represents a clising parenthesis
The parsed token represents a opening enumerable ('{')
The parsed token represents a closing enumerable ('}')
The parsed token represents an opening bracket ('[')
The parsed token represents a closing bracket (']')
The parsed token represents an enumerable
The parsed token represents a comma
The parsed token represents a semicolon
The parsed token represents a string
The parsed token represents content within a string
The parsed token represents a worksheet name
The parsed token represents the content of a worksheet name
The parsed token represents an integer value
The parsed token represents a boolean value
The parsed token represents a decimal value
The parsed token represents a percentage value
The parsed token represents an excel function
The parsed token represents an excel address
The parsed token represents a NameValue
The parsed token represents an InvalidReference error (#REF)
The parsed token represents a Numeric error (#NUM)
The parsed tokens represents an Value error (#VAL)
The parsed token represents the NULL value
The parsed token represent an unrecognized value
The parsed token represents an R1C1 address
The parsed token represents a circular reference
The parsed token represents a colon (address separator). Used for handling the offset function adress handling
The parsed token represents an address with the OFFSET function, either before, after or on both sides of the colon.
White space - Intersect operator will be set a operatar with the value " "
Represents an external reference
Refrence a table name in an address
Represents a table part in an address, for example "#this row"
Represents a table column name in an address.
Represents a cell address.
Alphnumeric characters representing a full column
An integer representing a full row
Reprensenting a the start of a function argument
An array
Represents a N/A error
Represents a single quote.
Represents a hash mark
Represents a pivot field in a pivot field formula
Represents a parameter variable declaration in functions such as LET or LAMBDA
Represents a name error
Represents a parameter variable in functions such as LET or LAMBDA
Used for logging during FormulaParsing
Called each time an exception occurs during formula parsing.
Called each time information should be logged during formula parsing.
Called to log a message outside the parsing context.
Called each time a cell within the calc chain is accessed during formula parsing.
Called each time a function is called during formula parsing.
Some functions measure performance, if so this function will be called.
Create loggers that can be used for logging the formula parser.
Creates a logger that logs to a simple textfile.
Provides access to static, preconfigured instances of
An empty
Implementation of the IsNamedValue function. In this case (Empty provider) it always return false.
Implementation of the GetNamedValue function. In this case (Empty provider) it always return null.
Implementation of the Reload function
Get named value
Configuration of a
Configures the formula calc engine to allow circular references.
If EPPlus will should cache expressions or not. Default is true.
In some functions EPPlus will round double values to 15 significant figures before the value is handled. This is an option for Excel compatibility.
The of the parser
The of the parser
Constructor
Factory method that creates an instance of this class
Attaches a logger, errors and log entries will be written to the logger during the parsing process.
if a logger is attached it will be removed.
Parsing context
The of the current context.
The is an abstraction on top of
Excel, in this case EPPlus.
The where the calculation is done.
Indicates how hidden cells should be handled by the currently
executing function.
Utility for handling addresses
of the current context
Configuration
Returns true if a is attached to the parser.
Factory method.
The ExcelPackage where calculation is done
Factory method
Represents the current cell
The worksheet where the current formula is located.
Represent strategies for handling precision and rounding of float/double values when calculating formulas.
Use .NET's default functionality
Use Excels strategy with max 15 significant figures.
EPPlus implementation of the interface.
Address
Row
Column
Formula
Value
Value double
Value double logical
Is hidden row
Returns true if the cell contains an error
Tokenized cell content
Cell id
Name of the worksheet
Provide the formula parser with information about an workbook external range.
The constructor
Index of the external workbook
The external worksheet index/id
The from row of the address
The from column of the address
The to row of the address
The to column of the address
Parsing context
Constructor with external workbook
Get the number of cells in the range
If the range is invalid (#REF!)
If the range is empty, ie contains no set cells.
If the range contains more than one set cell.
Size of the range
True if this is a range that doesn't is connected to a worksheet.
Return the current object in the enumeration
Not applicable for external ranges. Returns null
Dimension
Called when the object is disposed.
Moves to the next item in the enumeration
returns true until the enumeration has reached the last cell.
Resets the enumeration
Moves to the next item in the enumeration
Gets the enumerator
The enumerator
The address of the range
If the address contains multiple comma separated addresses, the individual addresses are stored here.
Gets the value
The row
The column
Get the value from the range with the offset from the top-left cell
The row offset.
The column offset.
Get offset
Is hidden
Provides information about an external cell in an external range.
The cell address.
The row of the cell
The column of the cell
Formula. Always return Empty.String for external cells.
The value of the current cell.
The value as double of the current cell. Bools will be ignored.
The value as double of the current cell.
If the row of the cell is hidden
If the value of the cell is an Excel Error
Tokens for the formula. Not applicable to External cells.
The cell id
The name of the worksheet.
EPPlus implementation of a range that keeps its data in memory
The constructor
Defines the size of the range
The constructor
The worksheet address that should be used for this range. Will be used for implicit intersection.
Defines the size of the range
Constructor
A list of values also defining the size of the range
Constructor
Another used as clone for this range. The address of the supplied range will not be copied.
Constructor
Number of rows in the new range
Number of columns in the new range
An empty range
Sets the value for a cell.
The row
The column
The value to set
Sets the for a cell directly
The row
The column
The cell
The in-memory range is never a reference error. Allways false.
If the range has no cells.
If the range is more than one cell.
If the range is an inmemory range. Allways true.
The size of the range.
The address of the inmemory range.
The worksheet.
The address of the range
Current
The addresses for the range, if more than one.
Dispose
Get enumerator
Get the number of cells in the range
The number of cells in range.
Returns the value with the offset from the top-left cell.
The row offset from the top-left cell.
The column offset from the top-left cell.
The value of the cell
Returns the value with the offset from the top-left cell.
The starting row offset from the top-left cell.
The starting column offset from the top-left cell.
The ending row offset from the top-left cell.
The ending column offset from the top-left cell
The value of the cell
If the cell's row is hidden.
Row offset from the top-left cell
Column offset from the top-left cell
Gets the value of a cell.
The row
The column
Get cell
Move next
Reset
EPPlus implementation of the interface
Nameinfo
Id
Worksheet name
The name
Formula of the name
Gets the forumla relative to a row and column.
The row
The column
Returns the range relative to the cell for a named range with a relative address.
Get the value relative to the current cell.
Tokens
Value
Name info with value
Name info with value
Id
wsIx
Name
Formula
Value
IsRelative
GetValue
Get relative formula
Get relative range
Represents the size of a range
Constructor
Number of rows
Number of columns
Constructor
From column
From row
To column
To row
Number of columns in the range
Number of rows in the range
EPPlus implementation of the interface
Constructor
Constructor
The worksheet
Parsing context
External reference id
The worksheet
Parsing context
Constructor
Parsing context
The total number of cells (including empty) of the range
Returns true if the range represents an invalid reference
Returns true if the range is empty
Returns true if more than one cell
Size of the range
Returns true if the range is an
Current cell
The worksheet
Dimension
Runs at dispose of this instance
IEnumerator.Current
Moves to next cell
Moves to next cell
Returns enumerator for cells
Returns enumerator for cells
The first address of the range
If the address contains more the one address (i.e A1:A2,A4), this array contains all addresses
Returns the cell value by 0-based index
0-based row index
0-based col index
Cell value
Return value by offset
Returns a subrange
Is hidden
Represent a function argument to validate
Type of the argument to validate
Constructor
The argument to validate
The argument to validate
Variable name of the argument
Sets the variable name of the argument.
The name
Utility for validation in functions.
Represent an argument to the function where the validation is implemented.
The argument to validate
Represents the errortypes in excel
Division by zero
Not applicable
Name error
Null error
Num error
Reference error
Value error
Calc error
Spill error from a dynamic array formula.
Represents Excel Errors
Represents an Excel error.
Handles the convertion between and the string values
used by Excel.
A constant for Div/0 error in Excel
A constant for the N/A error in Excel
A constant for the Name error in Excel
A constant for the Numm error in Excel
A constant for the Num error in Excel
A constant for the Ref error in Excel
A constant for the Value error in Excel
A constant for the Calc error in Excel
A constant for the Spill error in Excel
Returns true if the supplied is an excel error.
Returns true if the supplied is an excel error.
Converts a string to an
Thrown if the supplied value is not an Excel error
Creates an from a
The type of error to create
The
Returns the error as a
Parses a error value string and returns the
The error code
Is thrown when is empty
Is thrown when is not a valid Excel error.
If the argument cannot be converted.
The error type
Returns the string representation of the error type
Operator for addition.
Left side
Right side
Return the error value in V2
Operator for addition.
Left side
Right side
Return the error value in V1
Calculates a hash code for the object
Checks if the object is equals to another
The object to compare
True if equals
Id from a cell, column or row.
This is the id for a cell, row or column.
The id is a composit of the SheetID, the row number and the column number.
Bit 1-14 SheetID, Bit 15-28 Column number (0 if entire column), Bit 29- Row number (0 if entire row).
An exception thrown when the license context of EPPlus hasn't been set.
This interface is used to provide number formats for ranges
in runtime. The number formats are mapped to a number that can be used
to refer to a specific format.
Returns a number format by its
A number format that can be used on ranges
Base class for ExcelRangeBase.LoadFrom[...] functions
The range to which the data should be loaded
If true a header row will be printed above the data
If value is other than TableStyles.None the data will be added to a table in the worksheet.
Returns how many rows there are in the range (header row not included)
Returns how many columns there are in the range
Loads the data into the worksheet
Declares how headers should be parsed before they are added to the worksheet
Leaves the header as it is
Replaces any underscore characters with a space
Adds a space between camel cased words ('MyProp' => 'My Prop')
Replaces any underscore characters with a space and adds a space between camel cased words ('MyProp' => 'My Prop')
Parameters for the LoadFromCollection method
Default value for the BindingFlags property
The used when reading properties via reflection.
If not null, this specifies the members that should be used. Any member not present will be ignored.
Sets how headers should be parsed before added to the worksheet, see
Register keys to a property decorated with the . These will also
be used to create the column for this property.
The should map to the KeyId property of the attribute.
Key id used to store this set of keys
Keys for the
Registers default keys for properties decorated with the . These will also
be used to create the column for this property.
The keys to register
Sets an that will be used for setting NumberFormats in the range
The to use
Parameters from the
If the Caption of the DataColumn should be used as header.
The table style to use on the table created for the imported data.
null means that no table is created.
Transpose the loaded data
Parameters for the LoadFromDictionaries method
If set, only these keys will be included in the dataset
The keys supplied to this function will be included in the dataset, all others will be ignored.
The keys to include
Culture to be used when reading numbers/dates.
Sets how headers should be parsed before added to the worksheet, see
Data types used when setting data in the spreadsheet range (defined from left to right per column).
Parameters for the LoadFromDictionaries method
The first row in the text is the header row
The text to split
Describes how to split a CSV text.
Base class for parameter classes for Load functions
If true a row with headers will be added above the data
A custom name for the table, if created.
The TableName must be unique within the workbook and be a valid table name.
If set to another value than TableStyles.None the data will be added to a
table with the specified style
If true, EPPlus will add the built in (default) styles for hyperlinks and apply them on any member
that is of the or types. Default value is true.
Set if data should be transposed
Scans a type for properties decorated with the
and returns a list with all types reflected by these properties including the outer type.
Numberformat settings used in the
The worksheet of the cell.
The Row of the cell.
The column of the cell.
The number format settings for the cell
The value of the cell to be formatted
The text formatted by EPPlus
Provides access to the properties bag of the package
Provides access to all the office document properties.
Provides access to the XML document that holds all the code
document properties.
Gets/sets the title property of the document (core property)
Gets/sets the subject property of the document (core property)
Gets/sets the author property of the document (core property)
Gets/sets the comments property of the document (core property)
Gets/sets the keywords property of the document (core property)
Gets/sets the lastModifiedBy property of the document (core property)
Gets/sets the lastPrinted property of the document (core property)
Gets/sets the created property of the document (core property)
Gets/sets the category property of the document (core property)
Gets/sets the status property of the document (core property)
Provides access to the XML document that holds the extended properties of the document (app.xml)
Gets/Set the Application property of the document (extended property)
Gets/sets the HyperlinkBase property of the document (extended property)
Gets/Set the AppVersion property of the document (extended property)
Gets/sets the Company property of the document (extended property)
Gets/sets the Manager property of the document (extended property)
Gets/sets the modified property of the document (core property)
Indicates whether hyperlinks in a document are up-to-date
Hyperlinks need update
Display mode of the document thumbnail. True to enable scaling. False to enable cropping.
If true, document is shared between multiple producers.
Get the value of an extended property
The name of the property
The value
Set the value for an extended property
The name of the property
The value
Provides access to the XML document which holds the document's custom properties
Gets the value of a custom property
The name of the property
The current value of the property
Allows you to set the value of a current custom property or create your own custom property.
The name of the property
The value of the property
Saves the document properties back to the package.
This class exposes a set of COM-accessible wrappers for static
methods available on the ZipFile class. You don't need this
class unless you are using DotNetZip from a COM environment.
A wrapper for ZipFile.IsZipFile(string)
The filename to of the zip file to check.
true if the file contains a valid zip file.
A wrapper for ZipFile.IsZipFile(string, bool)
We cannot use "overloaded" Method names in COM interop.
So, here, we use a unique name.
The filename to of the zip file to check.
true if the file contains a valid zip file.
A wrapper for ZipFile.CheckZip(string)
The filename to of the zip file to check.
true if the named zip file checks OK. Otherwise, false.
A COM-friendly wrapper for the static method .
The filename to of the zip file to check.
The password to check.
true if the named zip file checks OK. Otherwise, false.
A wrapper for ZipFile.FixZipDirectory(string)
The filename to of the zip file to fix.
A wrapper for ZipFile.LibraryVersion
the version number on the DotNetZip assembly, formatted as a string.
An enum that provides the various encryption algorithms supported by this
library.
PkzipWeak implies the use of Zip 2.0 encryption, which is known to be
weak and subvertible.
A note on interoperability: Values of PkzipWeak and None are
specified in PKWARE's zip
specification, and are considered to be "standard". Zip archives
produced using these options will be interoperable with many other zip tools
and libraries, including Windows Explorer.
Values of WinZipAes128 and WinZipAes256 are not part of the Zip
specification, but rather imply the use of a vendor-specific extension from
WinZip. If you want to produce interoperable Zip archives, do not use these
values. For example, if you produce a zip archive using WinZipAes256, you
will be able to open it in Windows Explorer on Windows XP and Vista, but you
will not be able to extract entries; trying this will lead to an "unspecified
error". For this reason, some people have said that a zip archive that uses
WinZip's AES encryption is not actually a zip archive at all. A zip archive
produced this way will be readable with the WinZip tool (Version 11 and
beyond).
There are other third-party tools and libraries, both commercial and
otherwise, that support WinZip's AES encryption. These will be able to read
AES-encrypted zip archives produced by DotNetZip, and conversely applications
that use DotNetZip to read zip archives will be able to read AES-encrypted
archives produced by those tools or libraries. Consult the documentation for
those other tools and libraries to find out if WinZip's AES encryption is
supported.
In case you care: According to the WinZip specification, the
actual AES key used is derived from the via an
algorithm that complies with RFC 2898, using an iteration
count of 1000. The algorithm is sometimes referred to as PBKDF2, which stands
for "Password Based Key Derivation Function #2".
A word about password strength and length: The AES encryption technology is
very good, but any system is only as secure as the weakest link. If you want
to secure your data, be sure to use a password that is hard to guess. To make
it harder to guess (increase its "entropy"), you should make it longer. If
you use normal characters from an ASCII keyboard, a password of length 20 will
be strong enough that it will be impossible to guess. For more information on
that, I'd encourage you to read this
article.
The WinZip AES algorithms are not supported with the version of DotNetZip that
runs on the .NET Compact Framework. This is because .NET CF lacks the
HMACSHA1 class that is required for producing the archive.
No encryption at all.
Traditional or Classic pkzip encryption.
An encryption algorithm that is not supported by DotNetZip.
Delegate in which the application writes the ZipEntry content for the named entry.
The name of the entry that must be written.
The stream to which the entry data should be written.
When you add an entry and specify a WriteDelegate, via , the application
code provides the logic that writes the entry data directly into the zip file.
This example shows how to define a WriteDelegate that obtains a DataSet, and then
writes the XML for the DataSet into the zip archive. There's no need to
save the XML to a disk file first.
private void WriteEntry (String filename, Stream output)
{
DataSet ds1 = ObtainDataSet();
ds1.WriteXml(output);
}
private void Run()
{
using (var zip = new ZipFile())
{
zip.AddEntry(zipEntryName, WriteEntry);
zip.Save(zipFileName);
}
}
Private Sub WriteEntry (ByVal filename As String, ByVal output As Stream)
DataSet ds1 = ObtainDataSet()
ds1.WriteXml(stream)
End Sub
Public Sub Run()
Using zip = New ZipFile
zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry))
zip.Save(zipFileName)
End Using
End Sub
Delegate in which the application opens the stream, just-in-time, for the named entry.
The name of the ZipEntry that the application should open the stream for.
When you add an entry via , the application code provides the logic that
opens and closes the stream for the given ZipEntry.
Delegate in which the application closes the stream, just-in-time, for the named entry.
The name of the ZipEntry that the application should close the stream for.
The stream to be closed.
When you add an entry via , the application code provides the logic that
opens and closes the stream for the given ZipEntry.
Delegate for the callback by which the application tells the
library the CompressionLevel to use for a file.
Using this callback, the application can, for example, specify that
previously-compressed files (.mp3, .png, .docx, etc) should use a
CompressionLevel of None, or can set the compression level based
on any other factor.
In an EventArgs type, indicates which sort of progress event is being
reported.
There are events for reading, events for saving, and events for
extracting. This enumeration allows a single EventArgs type to be sued to
describe one of multiple subevents. For example, a SaveProgress event is
invoked before, after, and during the saving of a single entry. The value
of an enum with this type, specifies which event is being triggered. The
same applies to Extraction, Reading and Adding events.
Indicates that a Add() operation has started.
Indicates that an individual entry in the archive has been added.
Indicates that a Add() operation has completed.
Indicates that a Read() operation has started.
Indicates that an individual entry in the archive is about to be read.
Indicates that an individual entry in the archive has just been read.
Indicates that a Read() operation has completed.
The given event reports the number of bytes read so far
during a Read() operation.
Indicates that a Save() operation has started.
Indicates that an individual entry in the archive is about to be written.
Indicates that an individual entry in the archive has just been saved.
Indicates that a Save() operation has completed.
Indicates that the zip archive has been created in a
temporary location during a Save() operation.
Indicates that the temporary file is about to be renamed to the final archive
name during a Save() operation.
Indicates that the temporary file is has just been renamed to the final archive
name during a Save() operation.
Indicates that the self-extracting archive has been compiled
during a Save() operation.
The given event is reporting the number of source bytes that have run through the compressor so far
during a Save() operation.
Indicates that an entry is about to be extracted.
Indicates that an entry has just been extracted.
Indicates that extraction of an entry would overwrite an existing
filesystem file. You must use
ExtractExistingFileAction.InvokeExtractProgressEvent in the call
to ZipEntry.Extract() in order to receive this event.
The given event is reporting the number of bytes written so far for
the current entry during an Extract() operation.
Indicates that an ExtractAll operation is about to begin.
Indicates that an ExtractAll operation has completed.
Indicates that an error has occurred while saving a zip file.
This generally means the file cannot be opened, because it has been
removed, or because it is locked by another process. It can also
mean that the file cannot be Read, because of a range lock conflict.
Provides information about the progress of a save, read, or extract operation.
This is a base class; you will probably use one of the classes derived from this one.
The total number of entries to be saved or extracted.
The name of the last entry saved or extracted.
In an event handler, set this to cancel the save or extract
operation that is in progress.
The type of event being reported.
Returns the archive name associated to this event.
The number of bytes read or written so far for this entry.
Total number of bytes that will be read or written for this entry.
This number will be -1 if the value cannot be determined.
Provides information about the progress of a Read operation.
Provides information about the progress of a Add operation.
Provides information about the progress of a save operation.
Constructor for the SaveProgressEventArgs.
the name of the zip archive.
whether this is before saving the entry, or after
The total number of entries in the zip archive.
Number of entries that have been saved.
The entry involved in the event.
Number of entries saved so far.
Provides information about the progress of the extract operation.
Constructor for the ExtractProgressEventArgs.
the name of the zip archive.
whether this is before saving the entry, or after
The total number of entries in the zip archive.
Number of entries that have been extracted.
The entry involved in the event.
The location to which entries are extracted.
Number of entries extracted so far. This is set only if the
EventType is Extracting_BeforeExtractEntry or Extracting_AfterExtractEntry, and
the Extract() is occurring witin the scope of a call to ExtractAll().
Returns the extraction target location, a filesystem path.
Provides information about the an error that occurred while zipping.
Returns the exception that occurred, if any.
Returns the name of the file that caused the exception, if any.
Issued when an ZipEntry.ExtractWithPassword() method is invoked
with an incorrect password.
Default ctor.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
The innerException for this exception.
Indicates that a read was attempted on a stream, and bad or incomplete data was
received.
Default ctor.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
The innerException for this exception.
Issued when an CRC check fails upon extracting an entry from a zip archive.
Default ctor.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
Issued when errors occur saving a self-extracting archive.
Default ctor.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
Indicates that an operation was attempted on a ZipFile which was not possible
given the state of the instance. For example, if you call Save() on a ZipFile
which has no filename set, you can get this exception.
Default ctor.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
The innerException for this exception.
Base class for all exceptions defined by and throw by the Zip library.
Default ctor.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
Come on, you know how exceptions work. Why are you looking at this documentation?
The message in the exception.
The innerException for this exception.
An enum for the options when extracting an entry would overwrite an existing file.
This enum describes the actions that the library can take when an
Extract() or ExtractWithPassword() method is called to extract an
entry to a filesystem, and the extraction would overwrite an existing filesystem
file.
Throw an exception when extraction would overwrite an existing file. (For
COM clients, this is a 0 (zero).)
When extraction would overwrite an existing file, overwrite the file silently.
The overwrite will happen even if the target file is marked as read-only.
(For COM clients, this is a 1.)
When extraction would overwrite an existing file, don't overwrite the file, silently.
(For COM clients, this is a 2.)
When extraction would overwrite an existing file, invoke the ExtractProgress
event, using an event type of . In
this way, the application can decide, just-in-time, whether to overwrite the
file. For example, a GUI application may wish to pop up a dialog to allow
the user to choose. You may want to examine the property before making
the decision. If, after your processing in the Extract progress event, you
want to NOT extract the file, set
on the ZipProgressEventArgs.CurrentEntry to DoNotOverwrite.
If you do want to extract the file, set ZipEntry.ExtractExistingFile
to OverwriteSilently. If you want to cancel the Extraction, set
ZipProgressEventArgs.Cancel to true. Cancelling differs from using
DoNotOverwrite in that a cancel will not extract any further entries, if
there are any. (For COM clients, the value of this enum is a 3.)
Collects general purpose utility methods.
private null constructor
Utility routine for transforming path names from filesystem format (on Windows that means backslashes) to
a format suitable for use within zipfiles. This means trimming the volume letter and colon (if any) And
swapping backslashes for forward slashes.
source path.
transformed path
Finds a signature in the zip stream. This is useful for finding
the end of a zip entry, for example, or the beginning of the next ZipEntry.
Scans through 64k at a time.
If the method fails to find the requested signature, the stream Position
after completion of this method is unchanged. If the method succeeds in
finding the requested signature, the stream position after completion is
direct AFTER the signature found in the stream.
The stream to search
The 4-byte signature to find
The number of bytes read
Create a pseudo-random filename, suitable for use as a temporary
file, and open it.
The System.IO.Path.GetRandomFileName() method is not available on
the Compact Framework, so this library provides its own substitute
on NETCF.
This method produces a filename of the form
DotNetZip-xxxxxxxx.tmp, where xxxxxxxx is replaced by randomly
chosen characters, and creates that file.
Workitem 7889: handle ERROR_LOCK_VIOLATION during read
This could be gracefully handled with an extension attribute, but
This assembly is built for .NET 2.0, so I cannot use them.
A decorator stream. It wraps another stream, and performs bookkeeping
to keep track of the stream Position.
In some cases, it is not possible to get the Position of a stream, let's
say, on a write-only output stream like ASP.NET's
Response.OutputStream, or on a different write-only stream
provided as the destination for the zip by the application. In this
case, programmers can use this counting stream to count the bytes read
or written.
Consider the scenario of an application that saves a self-extracting
archive (SFX), that uses a custom SFX stub.
Saving to a filesystem file, the application would open the
filesystem file (getting a FileStream), save the custom sfx stub
into it, and then call ZipFile.Save(), specifying the same
FileStream. ZipFile.Save() does the right thing for the zipentry
offsets, by inquiring the Position of the FileStream before writing
any data, and then adding that initial offset into any ZipEntry
offsets in the zip directory. Everything works fine.
Now suppose the application is an ASPNET application and it saves
directly to Response.OutputStream. It's not possible for DotNetZip to
inquire the Position, so the offsets for the SFX will be wrong.
The workaround is for the application to use this class to wrap
HttpResponse.OutputStream, then write the SFX stub and the ZipFile
into that wrapper stream. Because ZipFile.Save() can inquire the
Position, it will then do the right thing with the offsets.
The constructor.
The underlying stream
Gets the wrapped stream.
The count of bytes written out to the stream.
the count of bytes that have been read from the stream.
Adjust the byte count on the stream.
the number of bytes to subtract from the count.
Subtract delta from the count of bytes written to the stream.
This is necessary when seeking back, and writing additional data,
as happens in some cases when saving Zip files.
The read method.
The buffer to hold the data read from the stream.
the offset within the buffer to copy the first byte read.
the number of bytes to read.
the number of bytes read, after decryption and decompression.
Write data into the stream.
The buffer holding data to write to the stream.
the offset within that data array to find the first byte to write.
the number of bytes to write.
Whether the stream can be read.
Whether it is possible to call Seek() on the stream.
Whether it is possible to call Write() on the stream.
Flushes the underlying stream.
The length of the underlying stream.
Returns the sum of number of bytes written, plus the initial
offset before writing.
The Position of the stream.
Seek in the stream.
the offset point to seek to
the reference point from which to seek
The new position
Set the length of the underlying stream. Be careful with this!
the length to set on the underlying stream.
This class implements the "traditional" or "classic" PKZip encryption,
which today is considered to be weak. On the other hand it is
ubiquitous. This class is intended for use only by the DotNetZip
library.
Most uses of the DotNetZip library will not involve direct calls into
the ZipCrypto class. Instead, the ZipCrypto class is instantiated and
used by the ZipEntry() class when encryption or decryption on an entry
is employed. If for some reason you really wanted to use a weak
encryption algorithm in some other application, you might use this
library. But you would be much better off using one of the built-in
strong encryption libraries in the .NET Framework, like the AES
algorithm or SHA.
The default constructor for ZipCrypto.
This class is intended for internal use by the library only. It's
probably not useful to you. Seriously. Stop reading this
documentation. It's a waste of your time. Go do something else.
Check the football scores. Go get an ice cream with a friend.
Seriously.
From AppNote.txt:
unsigned char decrypt_byte()
local unsigned short temp
temp :=- Key(2) | 2
decrypt_byte := (temp * (temp ^ 1)) bitshift-right 8
end decrypt_byte
Call this method on a cipher text to render the plaintext. You must
first initialize the cipher with a call to InitCipher.
var cipher = new ZipCrypto();
cipher.InitCipher(Password);
// Decrypt the header. This has a side effect of "further initializing the
// encryption keys" in the traditional zip encryption.
byte[] DecryptedMessage = cipher.DecryptMessage(EncryptedMessage);
The encrypted buffer.
The number of bytes to encrypt.
Should be less than or equal to CipherText.Length.
The plaintext.
This is the converse of DecryptMessage. It encrypts the plaintext
and produces a ciphertext.
The plain text buffer.
The number of bytes to encrypt.
Should be less than or equal to plainText.Length.
The ciphertext.
This initializes the cipher with the given password.
See AppNote.txt for details.
The passphrase for encrypting or decrypting with this cipher.
Step 1 - Initializing the encryption keys
-----------------------------------------
Start with these keys:
Key(0) := 305419896 (0x12345678)
Key(1) := 591751049 (0x23456789)
Key(2) := 878082192 (0x34567890)
Then, initialize the keys with a password:
loop for i from 0 to length(password)-1
update_keys(password(i))
end loop
Where update_keys() is defined as:
update_keys(char):
Key(0) := crc32(key(0),char)
Key(1) := Key(1) + (Key(0) bitwiseAND 000000ffH)
Key(1) := Key(1) * 134775813 + 1
Key(2) := crc32(key(2),key(1) rightshift 24)
end update_keys
Where crc32(old_crc,char) is a routine that given a CRC value and a
character, returns an updated CRC value after applying the CRC-32
algorithm described elsewhere in this document.
After the keys are initialized, then you can use the cipher to
encrypt the plaintext.
Essentially we encrypt the password with the keys, then discard the
ciphertext for the password. This initializes the keys for later use.
A Stream for reading and concurrently decrypting data from a zip file,
or for writing and concurrently encrypting data to a zip file.
The constructor.
The underlying stream
To either encrypt or decrypt.
The pre-initialized ZipCrypto object.
Represents a single entry in a ZipFile. Typically, applications get a ZipEntry
by enumerating the entries within a ZipFile, or by adding an entry to a ZipFile.
True if the referenced entry is a directory.
Provides a human-readable string with information about the ZipEntry.
Reads one entry from the zip directory structure in the zip file.
The zipfile for which a directory entry will be read. From this param, the
method gets the ReadStream and the expected text encoding
(ProvisionalAlternateEncoding) which is used if the entry is not marked
UTF-8.
a list of previously seen entry names; used to prevent duplicates.
the entry read from the archive.
Returns true if the passed-in value is a valid signature for a ZipDirEntry.
the candidate 4-byte signature value.
true, if the signature is valid according to the PKWare spec.
Default constructor.
Applications should never need to call this directly. It is exposed to
support COM Automation environments.
The time and date at which the file indicated by the ZipEntry was
last modified.
The DotNetZip library sets the LastModified value for an entry, equal to
the Last Modified time of the file in the filesystem. If an entry is
added from a stream, the library uses System.DateTime.Now for this
value, for the given entry.
This property allows the application to retrieve and possibly set the
LastModified value on an entry, to an arbitrary value. values with a
setting of DateTimeKind.Unspecified are taken to be expressed as
DateTimeKind.Local.
Be aware that because of the way PKWare's
Zip specification describes how times are stored in the zip file,
the full precision of the System.DateTime datatype is not stored
for the last modified time when saving zip files. For more information on
how times are formatted, see the PKZip specification.
The actual last modified time of a file can be stored in multiple ways in
the zip file, and they are not mutually exclusive:
-
In the so-called "DOS" format, which has a 2-second precision. Values
are rounded to the nearest even second. For example, if the time on the
file is 12:34:43, then it will be stored as 12:34:44. This first value
is accessible via the LastModified property. This value is always
present in the metadata for each zip entry. In some cases the value is
invalid, or zero.
-
In the so-called "Windows" or "NTFS" format, as an 8-byte integer
quantity expressed as the number of 1/10 milliseconds (in other words
the number of 100 nanosecond units) since January 1, 1601 (UTC). This
format is how Windows represents file times. This time is accessible
via the ModifiedTime property.
-
In the "Unix" format, a 4-byte quantity specifying the number of seconds since
January 1, 1970 UTC.
-
In an older format, now deprecated but still used by some current
tools. This format is also a 4-byte quantity specifying the number of
seconds since January 1, 1970 UTC.
Zip tools and libraries will always at least handle (read or write) the
DOS time, and may also handle the other time formats. Keep in mind that
while the names refer to particular operating systems, there is nothing in
the time formats themselves that prevents their use on other operating
systems.
When reading ZIP files, the DotNetZip library reads the Windows-formatted
time, if it is stored in the entry, and sets both LastModified and
ModifiedTime to that value. When writing ZIP files, the DotNetZip
library by default will write both time quantities. It can also emit the
Unix-formatted time if desired (See .)
The last modified time of the file created upon a call to
ZipEntry.Extract() may be adjusted during extraction to compensate
for differences in how the .NET Base Class Library deals with daylight
saving time (DST) versus how the Windows filesystem deals with daylight
saving time. Raymond Chen provides
some good context.
In a nutshell: Daylight savings time rules change regularly. In 2007, for
example, the inception week of DST changed. In 1977, DST was in place all
year round. In 1945, likewise. And so on. Win32 does not attempt to
guess which time zone rules were in effect at the time in question. It
will render a time as "standard time" and allow the app to change to DST
as necessary. .NET makes a different choice.
Compare the output of FileInfo.LastWriteTime.ToString("f") with what you
see in the Windows Explorer property sheet for a file that was last
written to on the other side of the DST transition. For example, suppose
the file was last modified on October 17, 2003, during DST but DST is not
currently in effect. Explorer's file properties reports Thursday, October
17, 2003, 8:45:38 AM, but .NETs FileInfo reports Thursday, October 17,
2003, 9:45 AM.
Win32 says, "Thursday, October 17, 2002 8:45:38 AM PST". Note: Pacific
STANDARD Time. Even though October 17 of that year occurred during Pacific
Daylight Time, Win32 displays the time as standard time because that's
what time it is NOW.
.NET BCL assumes that the current DST rules were in place at the time in
question. So, .NET says, "Well, if the rules in effect now were also in
effect on October 17, 2003, then that would be daylight time" so it
displays "Thursday, October 17, 2003, 9:45 AM PDT" - daylight time.
So .NET gives a value which is more intuitively correct, but is also
potentially incorrect, and which is not invertible. Win32 gives a value
which is intuitively incorrect, but is strictly correct.
Because of this funkiness, this library adds one hour to the LastModified
time on the extracted file, if necessary. That is to say, if the time in
question had occurred in what the .NET Base Class Library assumed to be
DST. This assumption may be wrong given the constantly changing DST rules,
but it is the best we can do.
Last Modified time for the file represented by the entry.
This value corresponds to the "last modified" time in the NTFS file times
as described in the Zip
specification. When getting this property, the value may be
different from . When setting the property,
the property also gets set, but with a lower
precision.
Let me explain. It's going to take a while, so get
comfortable. Originally, waaaaay back in 1989 when the ZIP specification
was originally described by the esteemed Mr. Phil Katz, the dominant
operating system of the time was MS-DOS. MSDOS stored file times with a
2-second precision, because, c'mon, who is ever going to need better
resolution than THAT? And so ZIP files, regardless of the platform on
which the zip file was created, store file times in exactly the same format that DOS used
in 1989.
Since then, the ZIP spec has evolved, but the internal format for file
timestamps remains the same. Despite the fact that the way times are
stored in a zip file is rooted in DOS heritage, any program on any
operating system can format a time in this way, and most zip tools and
libraries DO - they round file times to the nearest even second and store
it just like DOS did 25+ years ago.
PKWare extended the ZIP specification to allow a zip file to store what
are called "NTFS Times" and "Unix(tm) times" for a file. These are the
last write, last access, and file creation
times of a particular file. These metadata are not actually specific
to NTFS or Unix. They are tracked for each file by NTFS and by various
Unix filesystems, but they are also tracked by other filesystems, too.
The key point is that the times are formatted in the zip file
in the same way that NTFS formats the time (ticks since win32 epoch),
or in the same way that Unix formats the time (seconds since Unix
epoch). As with the DOS time, any tool or library running on any
operating system is capable of formatting a time in one of these ways
and embedding it into the zip file.
These extended times are higher precision quantities than the DOS time.
As described above, the (DOS) LastModified has a precision of 2 seconds.
The Unix time is stored with a precision of 1 second. The NTFS time is
stored with a precision of 0.0000001 seconds. The quantities are easily
convertible, except for the loss of precision you may incur.
A zip archive can store the {C,A,M} times in NTFS format, in Unix format,
or not at all. Often a tool running on Unix or Mac will embed the times
in Unix format (1 second precision), while WinZip running on Windows might
embed the times in NTFS format (precision of of 0.0000001 seconds). When
reading a zip file with these "extended" times, in either format,
DotNetZip represents the values with the
ModifiedTime, AccessedTime and CreationTime
properties on the ZipEntry.
While any zip application or library, regardless of the platform it
runs on, could use any of the time formats allowed by the ZIP
specification, not all zip tools or libraries do support all these
formats. Storing the higher-precision times for each entry is
optional for zip files, and many tools and libraries don't use the
higher precision quantities at all. The old DOS time, represented by
, is guaranteed to be present, though it
sometimes unset.
Ok, getting back to the question about how the LastModified
property relates to this ModifiedTime
property... LastModified is always set, while
ModifiedTime is not. (The other times stored in the NTFS
times extension, CreationTime and AccessedTime also
may not be set on an entry that is read from an existing zip file.)
When reading a zip file, then LastModified takes the DOS time
that is stored with the file. If the DOS time has been stored as zero
in the zipfile, then this library will use DateTime.Now for the
LastModified value. If the ZIP file was created by an evolved
tool, then there will also be higher precision NTFS or Unix times in
the zip file. In that case, this library will read those times, and
set LastModified and ModifiedTime to the same value, the
one corresponding to the last write time of the file. If there are no
higher precision times stored for the entry, then ModifiedTime
remains unset (likewise AccessedTime and CreationTime),
and LastModified keeps its DOS time.
When creating zip files with this library, by default the extended time
properties (ModifiedTime, AccessedTime, and
CreationTime) are set on the ZipEntry instance, and these data are
stored in the zip archive for each entry, in NTFS format. If you add an
entry from an actual filesystem file, then the entry gets the actual file
times for that file, to NTFS-level precision. If you add an entry from a
stream, or a string, then the times get the value DateTime.Now. In
this case LastModified and ModifiedTime will be identical,
to 2 seconds of precision. You can explicitly set the
CreationTime, AccessedTime, and ModifiedTime of an
entry using the property setters. If you want to set all of those
quantities, it's more efficient to use the method. Those
changes are not made permanent in the zip file until you call or one of its cousins.
When creating a zip file, you can override the default behavior of
this library for formatting times in the zip file, disabling the
embedding of file times in NTFS format or enabling the storage of file
times in Unix format, or both. You may want to do this, for example,
when creating a zip file on Windows, that will be consumed on a Mac,
by an application that is not hip to the "NTFS times" format. To do
this, use the and
properties. A valid zip
file may store the file times in both formats. But, there are no
guarantees that a program running on Mac or Linux will gracefully
handle the NTFS-formatted times when Unix times are present, or that a
non-DotNetZip-powered application running on Windows will be able to
handle file times in Unix format. DotNetZip will always do something
reasonable; other libraries or tools may not. When in doubt, test.
I'll bet you didn't think one person could type so much about time, eh?
And reading it was so enjoyable, too! Well, in appreciation, maybe you
should donate?
Last Access time for the file represented by the entry.
This value may or may not be meaningful. If the ZipEntry was read from an existing
Zip archive, this information may not be available. For an explanation of why, see
.
The file creation time for the file represented by the entry.
This value may or may not be meaningful. If the ZipEntry was read
from an existing zip archive, and the creation time was not set on the entry
when the zip file was created, then this property may be meaningless. For an
explanation of why, see .
Sets the NTFS Creation, Access, and Modified times for the given entry.
When adding an entry from a file or directory, the Creation, Access, and
Modified times for the given entry are automatically set from the
filesystem values. When adding an entry from a stream or string, the
values are implicitly set to DateTime.Now. The application may wish to
set these values to some arbitrary value, before saving the archive, and
can do so using the various setters. If you want to set all of the times,
this method is more efficient.
The values you set here will be retrievable with the , and properties.
When this method is called, if both and are false, then the
EmitTimesInWindowsFormatWhenSaving flag is automatically set.
DateTime values provided here without a DateTimeKind are assumed to be Local Time.
the creation time of the entry.
the last access time of the entry.
the last modified time of the entry.
Specifies whether the Creation, Access, and Modified times for the given
entry will be emitted in "Windows format" when the zip archive is saved.
An application creating a zip archive can use this flag to explicitly
specify that the file times for the entry should or should not be stored
in the zip archive in the format used by Windows. The default value of
this property is true.
When adding an entry from a file or directory, the Creation (), Access (), and Modified
() times for the given entry are automatically
set from the filesystem values. When adding an entry from a stream or
string, all three values are implicitly set to DateTime.Now. Applications
can also explicitly set those times by calling .
PKWARE's
zip specification describes multiple ways to format these times in a
zip file. One is the format Windows applications normally use: 100ns ticks
since Jan 1, 1601 UTC. The other is a format Unix applications typically
use: seconds since January 1, 1970 UTC. Each format can be stored in an
"extra field" in the zip entry when saving the zip archive. The former
uses an extra field with a Header Id of 0x000A, while the latter uses a
header ID of 0x5455.
Not all zip tools and libraries can interpret these fields. Windows
compressed folders is one that can read the Windows Format timestamps,
while I believe the Infozip
tools can read the Unix format timestamps. Although the time values are
easily convertible, subject to a loss of precision, some tools and
libraries may be able to read only one or the other. DotNetZip can read or
write times in either or both formats.
The times stored are taken from , , and .
This property is not mutually exclusive from the property. It is
possible that a zip entry can embed the timestamps in both forms, one
form, or neither. But, there are no guarantees that a program running on
Mac or Linux will gracefully handle NTFS Formatted times, or that a
non-DotNetZip-powered application running on Windows will be able to
handle file times in Unix format. When in doubt, test.
Normally you will use the ZipFile.EmitTimesInWindowsFormatWhenSaving
property, to specify the behavior for all entries in a zip, rather than
the property on each individual entry.
Specifies whether the Creation, Access, and Modified times for the given
entry will be emitted in "Unix(tm) format" when the zip archive is saved.
An application creating a zip archive can use this flag to explicitly
specify that the file times for the entry should or should not be stored
in the zip archive in the format used by Unix. By default this flag is
false, meaning the Unix-format times are not stored in the zip
archive.
When adding an entry from a file or directory, the Creation (), Access (), and Modified
() times for the given entry are automatically
set from the filesystem values. When adding an entry from a stream or
string, all three values are implicitly set to DateTime.Now. Applications
can also explicitly set those times by calling .
PKWARE's
zip specification describes multiple ways to format these times in a
zip file. One is the format Windows applications normally use: 100ns ticks
since Jan 1, 1601 UTC. The other is a format Unix applications typically
use: seconds since Jan 1, 1970 UTC. Each format can be stored in an
"extra field" in the zip entry when saving the zip archive. The former
uses an extra field with a Header Id of 0x000A, while the latter uses a
header ID of 0x5455.
Not all tools and libraries can interpret these fields. Windows
compressed folders is one that can read the Windows Format timestamps,
while I believe the Infozip
tools can read the Unix format timestamps. Although the time values are
easily convertible, subject to a loss of precision, some tools and
libraries may be able to read only one or the other. DotNetZip can read or
write times in either or both formats.
The times stored are taken from , , and .
This property is not mutually exclusive from the property. It is
possible that a zip entry can embed the timestamps in both forms, one
form, or neither. But, there are no guarantees that a program running on
Mac or Linux will gracefully handle NTFS Formatted times, or that a
non-DotNetZip-powered application running on Windows will be able to
handle file times in Unix format. When in doubt, test.
Normally you will use the ZipFile.EmitTimesInUnixFormatWhenSaving
property, to specify the behavior for all entries, rather than the
property on each individual entry.
The type of timestamp attached to the ZipEntry.
This property is valid only for a ZipEntry that was read from a zip archive.
It indicates the type of timestamp attached to the entry.
The file attributes for the entry.
The attributes in NTFS include
ReadOnly, Archive, Hidden, System, and Indexed. When adding a
ZipEntry to a ZipFile, these attributes are set implicitly when
adding an entry from the filesystem. When adding an entry from a stream
or string, the Attributes are not set implicitly. Regardless of the way
an entry was added to a ZipFile, you can set the attributes
explicitly if you like.
When reading a ZipEntry from a ZipFile, the attributes are
set according to the data stored in the ZipFile. If you extract the
entry from the archive to a filesystem file, DotNetZip will set the
attributes on the resulting file accordingly.
The attributes can be set explicitly by the application. For example the
application may wish to set the FileAttributes.ReadOnly bit for all
entries added to an archive, so that on unpack, this attribute will be set
on the extracted file. Any changes you make to this property are made
permanent only when you call a Save() method on the ZipFile
instance that contains the ZipEntry.
For example, an application may wish to zip up a directory and set the
ReadOnly bit on every file in the archive, so that upon later extraction,
the resulting files will be marked as ReadOnly. Not every extraction tool
respects these attributes, but if you unpack with DotNetZip, as for
example in a self-extracting archive, then the attributes will be set as
they are stored in the ZipFile.
These attributes may not be interesting or useful if the resulting archive
is extracted on a non-Windows platform. How these attributes get used
upon extraction depends on the platform and tool used.
This property is only partially supported in the Silverlight version
of the library: applications can read attributes on entries within
ZipFiles. But extracting entries within Silverlight will not set the
attributes on the extracted files.
The name of the filesystem file, referred to by the ZipEntry.
This property specifies the thing-to-be-zipped on disk, and is set only
when the ZipEntry is being created from a filesystem file. If the
ZipFile is instantiated by reading an existing .zip archive, then
the LocalFileName will be null (Nothing in VB).
When it is set, the value of this property may be different than , which is the path used in the archive itself. If you
call Zip.AddFile("foop.txt", AlternativeDirectory), then the path
used for the ZipEntry within the zip archive will be different
than this path.
If the entry is being added from a stream, then this is null (Nothing in VB).
The name of the file contained in the ZipEntry.
This is the name of the entry in the ZipFile itself. When creating
a zip archive, if the ZipEntry has been created from a filesystem
file, via a call to or , or a related overload, the value
of this property is derived from the name of that file. The
FileName property does not include drive letters, and may include a
different directory path, depending on the value of the
directoryPathInArchive parameter used when adding the entry into
the ZipFile.
In some cases there is no related filesystem file - for example when a
ZipEntry is created using or one of the similar overloads. In this case, the value of
this property is derived from the fileName and the directory path passed
to that method.
When reading a zip file, this property takes the value of the entry name
as stored in the zip file. If you extract such an entry, the extracted
file will take the name given by this property.
Applications can set this property when creating new zip archives or when
reading existing archives. When setting this property, the actual value
that is set will replace backslashes with forward slashes, in accordance
with the Zip
specification, for compatibility with Unix(tm) and ... get
this.... Amiga!
If an application reads a ZipFile via or a related overload, and then explicitly
sets the FileName on an entry contained within the ZipFile, and
then calls , the application will effectively
rename the entry within the zip archive.
If an application sets the value of FileName, then calls
Extract() on the entry, the entry is extracted to a file using the
newly set value as the filename. The FileName value is made
permanent in the zip archive only after a call to one of the
ZipFile.Save() methods on the ZipFile that contains the
ZipEntry.
If an application attempts to set the FileName to a value that
would result in a duplicate entry in the ZipFile, an exception is
thrown.
When a ZipEntry is contained within a ZipFile, applications
cannot rename the entry within the context of a foreach (For
Each in VB) loop, because of the way the ZipFile stores
entries. If you need to enumerate through all the entries and rename one
or more of them, use ZipFile.EntriesSorted as the
collection. See also, ZipFile.GetEnumerator().
The stream that provides content for the ZipEntry.
The application can use this property to set the input stream for an
entry on a just-in-time basis. Imagine a scenario where the application
creates a ZipFile comprised of content obtained from hundreds of
files, via calls to AddFile(). The DotNetZip library opens streams
on these files on a just-in-time basis, only when writing the entry out to
an external store within the scope of a ZipFile.Save() call. Only
one input stream is opened at a time, as each entry is being written out.
Now imagine a different application that creates a ZipFile
with content obtained from hundreds of streams, added through . Normally the
application would supply an open stream to that call. But when large
numbers of streams are being added, this can mean many open streams at one
time, unnecessarily.
To avoid this, call and specify delegates that open and close the stream at
the time of Save.
Setting the value of this property when the entry was not added from a
stream (for example, when the ZipEntry was added with or , or when the entry was added by
reading an existing zip archive) will throw an exception.
A flag indicating whether the InputStream was provided Just-in-time.
When creating a zip archive, an application can obtain content for one or
more of the ZipEntry instances from streams, using the method. At the time
of calling that method, the application can supply null as the value of
the stream parameter. By doing so, the application indicates to the
library that it will provide a stream for the entry on a just-in-time
basis, at the time one of the ZipFile.Save() methods is called and
the data for the various entries are being compressed and written out.
In this case, the application can set the
property, typically within the SaveProgress event (event type: ) for that entry.
The application will later want to call Close() and Dispose() on that
stream. In the SaveProgress event, when the event type is , the application can
do so. This flag indicates that the stream has been provided by the
application on a just-in-time basis and that it is the application's
responsibility to call Close/Dispose on that stream.
An enum indicating the source of the ZipEntry.
The version of the zip engine needed to read the ZipEntry.
This is a readonly property, indicating the version of the Zip
specification that the extracting tool or library must support to
extract the given entry. Generally higher versions indicate newer
features. Older zip engines obviously won't know about new features, and
won't be able to extract entries that depend on those newer features.
value
Features
-
20
a basic Zip Entry, potentially using PKZIP encryption.
-
45
The ZIP64 extension is used on the entry.
-
46
File is compressed using BZIP2 compression*
-
50
File is encrypted using PkWare's DES, 3DES, (broken) RC2 or RC4
-
51
File is encrypted using PKWare's AES encryption or corrected RC2 encryption.
-
52
File is encrypted using corrected RC2-64 encryption**
-
61
File is encrypted using non-OAEP key wrapping***
-
63
File is compressed using LZMA, PPMd+, Blowfish, or Twofish
There are other values possible, not listed here. DotNetZip supports
regular PKZip encryption, and ZIP64 extensions. DotNetZip cannot extract
entries that require a zip engine higher than 45.
This value is set upon reading an existing zip file, or after saving a zip
archive.
The comment attached to the ZipEntry.
Each entry in a zip file can optionally have a comment associated to
it. The comment might be displayed by a zip tool during extraction, for
example.
By default, the Comment is encoded in IBM437 code page. You can
specify an alternative with and
.
Indicates whether the entry requires ZIP64 extensions.
This property is null (Nothing in VB) until a Save() method on the
containing instance has been called. The property is
non-null (HasValue is true) only after a Save() method has
been called.
After the containing ZipFile has been saved, the Value of this
property is true if any of the following three conditions holds: the
uncompressed size of the entry is larger than 0xFFFFFFFF; the compressed
size of the entry is larger than 0xFFFFFFFF; the relative offset of the
entry within the zip archive is larger than 0xFFFFFFFF. These quantities
are not known until a Save() is attempted on the zip archive and
the compression is applied.
If none of the three conditions holds, then the Value is false.
A Value of false does not indicate that the entry, as saved in the
zip archive, does not use ZIP64. It merely indicates that ZIP64 is
not required. An entry may use ZIP64 even when not required if
the property on the containing
ZipFile instance is set to , or if
the property on the containing
ZipFile instance is set to
and the output stream was not seekable.
Indicates whether the entry actually used ZIP64 extensions, as it was most
recently written to the output file or stream.
This Nullable property is null (Nothing in VB) until a Save()
method on the containing instance has been
called. HasValue is true only after a Save() method has been
called.
The value of this property for a particular ZipEntry may change
over successive calls to Save() methods on the containing ZipFile,
even if the file that corresponds to the ZipEntry does not. This
may happen if other entries contained in the ZipFile expand,
causing the offset for this particular entry to exceed 0xFFFFFFFF.
The bitfield for the entry as defined in the zip spec. You probably
never need to look at this.
You probably do not need to concern yourself with the contents of this
property, but in case you do:
bit
meaning
-
0
set if encryption is used.
-
1-2
set to determine whether normal, max, fast deflation. DotNetZip library
always leaves these bits unset when writing (indicating "normal"
deflation"), but can read an entry with any value here.
-
3
Indicates that the Crc32, Compressed and Uncompressed sizes are zero in the
local header. This bit gets set on an entry during writing a zip file, when
it is saved to a non-seekable output stream.
-
4
reserved for "enhanced deflating". This library doesn't do enhanced deflating.
-
5
set to indicate the zip is compressed patched data. This library doesn't do that.
-
6
set if PKWare's strong encryption is used (must also set bit 1 if bit 6 is
set). This bit is not set if WinZip's AES encryption is set.
-
7
not used
-
8
not used
-
9
not used
-
10
not used
-
11
Language encoding flag (EFS). If this bit is set, the filename and comment
fields for this file must be encoded using UTF-8. This library currently
does not support UTF-8.
-
12
Reserved by PKWARE for enhanced compression.
-
13
Used when encrypting the Central Directory to indicate selected data
values in the Local Header are masked to hide their actual values. See
the section in the Zip
specification describing the Strong Encryption Specification for
details.
-
14
Reserved by PKWARE.
-
15
Reserved by PKWARE.
The compression method employed for this ZipEntry.
The
Zip specification allows a variety of compression methods. This
library supports just two: 0x08 = Deflate. 0x00 = Store (no compression),
for reading or writing.
When reading an entry from an existing zipfile, the value you retrieve
here indicates the compression method used on the entry by the original
creator of the zip. When writing a zipfile, you can specify either 0x08
(Deflate) or 0x00 (None). If you try setting something else, you will get
an exception.
You may wish to set CompressionMethod to CompressionMethod.None (0)
when zipping already-compressed data like a jpg, png, or mp3 file.
This can save time and cpu cycles.
When setting this property on a ZipEntry that is read from an
existing zip file, calling ZipFile.Save() will cause the new
CompressionMethod to be used on the entry in the newly saved zip file.
Setting this property may have the side effect of modifying the
CompressionLevel property. If you set the CompressionMethod to a
value other than None, and CompressionLevel is previously
set to None, then CompressionLevel will be set to
Default.
In this example, the first entry added to the zip archive uses the default
behavior - compression is used where it makes sense. The second entry,
the MP3 file, is added to the archive without being compressed.
using (ZipFile zip = new ZipFile(ZipFileToCreate))
{
ZipEntry e1= zip.AddFile(@"notes\Readme.txt");
ZipEntry e2= zip.AddFile(@"music\StopThisTrain.mp3");
e2.CompressionMethod = CompressionMethod.None;
zip.Save();
}
Using zip As New ZipFile(ZipFileToCreate)
zip.AddFile("notes\Readme.txt")
Dim e2 as ZipEntry = zip.AddFile("music\StopThisTrain.mp3")
e2.CompressionMethod = CompressionMethod.None
zip.Save
End Using
Sets the compression level to be used for the entry when saving the zip
archive. This applies only for CompressionMethod = DEFLATE.
When using the DEFLATE compression method, Varying the compression
level used on entries can affect the size-vs-speed tradeoff when
compression and decompressing data streams or files.
If you do not set this property, the default compression level is used,
which normally gives a good balance of compression efficiency and
compression speed. In some tests, using BestCompression can
double the time it takes to compress, while delivering just a small
increase in compression efficiency. This behavior will vary with the
type of data you compress. If you are in doubt, just leave this setting
alone, and accept the default.
When setting this property on a ZipEntry that is read from an
existing zip file, calling ZipFile.Save() will cause the new
CompressionLevel to be used on the entry in the newly saved zip file.
Setting this property may have the side effect of modifying the
CompressionMethod property. If you set the CompressionLevel
to a value other than None, CompressionMethod will be set
to Deflate, if it was previously None.
Setting this property has no effect if the CompressionMethod is something
other than Deflate or None.
The compressed size of the file, in bytes, within the zip archive.
When reading a ZipFile, this value is read in from the existing
zip file. When creating or updating a ZipFile, the compressed
size is computed during compression. Therefore the value on a
ZipEntry is valid after a call to Save() (or one of its
overloads) in that case.
The size of the file, in bytes, before compression, or after extraction.
When reading a ZipFile, this value is read in from the existing
zip file. When creating or updating a ZipFile, the uncompressed
size is computed during compression. Therefore the value on a
ZipEntry is valid after a call to Save() (or one of its
overloads) in that case.
The ratio of compressed size to uncompressed size of the ZipEntry.
This is a ratio of the compressed size to the uncompressed size of the
entry, expressed as a double in the range of 0 to 100+. A value of 100
indicates no compression at all. It could be higher than 100 when the
compression algorithm actually inflates the data, as may occur for small
files, or uncompressible data that is encrypted.
You could format it for presentation to a user via a format string of
"{3,5:F0}%" to see it as a percentage.
If the size of the original uncompressed file is 0, implying a
denominator of 0, the return value will be zero.
This property is valid after reading in an existing zip file, or after
saving the ZipFile that contains the ZipEntry. You cannot know the
effect of a compression transform until you try it.
The 32-bit CRC (Cyclic Redundancy Check) on the contents of the ZipEntry.
You probably don't need to concern yourself with this. It is used
internally by DotNetZip to verify files or streams upon extraction.
The value is a 32-bit
CRC using 0xEDB88320 for the polynomial. This is the same CRC-32 used in
PNG, MPEG-2, and other protocols and formats. It is a read-only property; when
creating a Zip archive, the CRC for each entry is set only after a call to
Save() on the containing ZipFile. When reading an existing zip file, the value
of this property reflects the stored CRC for the entry.
True if the entry is a directory (not a file).
This is a readonly property on the entry.
A derived property that is true if the entry uses encryption.
This is a readonly property on the entry. When reading a zip file,
the value for the ZipEntry is determined by the data read
from the zip file. After saving a ZipFile, the value of this
property for each ZipEntry indicates whether encryption was
actually used (which will have been true if the was set and the property
was something other than .
Set this to specify which encryption algorithm to use for the entry when
saving it to a zip archive.
Set this property in order to encrypt the entry when the ZipFile is
saved. When setting this property, you must also set a on the entry. If you set a value other than on this property and do not set a
Password then the entry will not be encrypted. The ZipEntry
data is encrypted as the ZipFile is saved, when you call or one of its cousins on the containing
ZipFile instance. You do not need to specify the Encryption
when extracting entries from an archive.
The Zip specification from PKWare defines a set of encryption algorithms,
and the data formats for the zip archive that support them, and PKWare
supports those algorithms in the tools it produces. Other vendors of tools
and libraries, such as WinZip or Xceed, typically support a
subset of the algorithms specified by PKWare. These tools can
sometimes support additional different encryption algorithms and data
formats, not specified by PKWare. The AES Encryption specified and
supported by WinZip is the most popular example. This library supports a
subset of the complete set of algorithms specified by PKWare and other
vendors.
There is no common, ubiquitous multi-vendor standard for strong encryption
within zip files. There is broad support for so-called "traditional" Zip
encryption, sometimes called Zip 2.0 encryption, as specified
by PKWare, but this encryption is considered weak and
breakable. This library currently supports the Zip 2.0 "weak" encryption,
and also a stronger WinZip-compatible AES encryption, using either 128-bit
or 256-bit key strength. If you want DotNetZip to support an algorithm
that is not currently supported, call the author of this library and maybe
we can talk business.
The class also has a property. In most cases you will use
that property when setting encryption. This property takes
precedence over any Encryption set on the ZipFile itself.
Typically, you would use the per-entry Encryption when most entries in the
zip archive use one encryption algorithm, and a few entries use a
different one. If all entries in the zip file use the same Encryption,
then it is simpler to just set this property on the ZipFile itself, when
creating a zip archive.
Some comments on updating archives: If you read a ZipFile, you can
modify the Encryption on an encrypted entry: you can remove encryption
from an entry that was encrypted; you can encrypt an entry that was not
encrypted previously; or, you can change the encryption algorithm. The
changes in encryption are not made permanent until you call Save() on the
ZipFile. To effect changes in encryption, the entry content is
streamed through several transformations, depending on the modification
the application has requested. For example if the entry is not encrypted
and the application sets Encryption to PkzipWeak, then at
the time of Save(), the original entry is read and decompressed,
then re-compressed and encrypted. Conversely, if the original entry is
encrypted with PkzipWeak encryption, and the application sets the
Encryption property to WinZipAes128, then at the time of
Save(), the original entry is decrypted via PKZIP encryption and
decompressed, then re-compressed and re-encrypted with AES. This all
happens automatically within the library, but it can be time-consuming for
large entries.
Additionally, when updating archives, it is not possible to change the
password when changing the encryption algorithm. To change both the
algorithm and the password, you need to Save() the zipfile twice. First
set the Encryption to None, then call Save(). Then set the
Encryption to the new value (not "None"), then call Save()
once again.
The WinZip AES encryption algorithms are not supported on the .NET Compact
Framework.
This example creates a zip archive that uses encryption, and then extracts
entries from the archive. When creating the zip archive, the ReadMe.txt
file is zipped without using a password or encryption. The other file
uses encryption.
// Create a zip archive with AES Encryption.
using (ZipFile zip = new ZipFile())
{
zip.AddFile("ReadMe.txt")
ZipEntry e1= zip.AddFile("2008-Regional-Sales-Report.pdf");
e1.Encryption= EncryptionAlgorithm.WinZipAes256;
e1.Password= "Top.Secret.No.Peeking!";
zip.Save("EncryptedArchive.zip");
}
// Extract a zip archive that uses AES Encryption.
// You do not need to specify the algorithm during extraction.
using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
{
// Specify the password that is used during extraction, for
// all entries that require a password:
zip.Password= "Top.Secret.No.Peeking!";
zip.ExtractAll("extractDirectory");
}
' Create a zip that uses Encryption.
Using zip As New ZipFile()
zip.AddFile("ReadMe.txt")
Dim e1 as ZipEntry
e1= zip.AddFile("2008-Regional-Sales-Report.pdf")
e1.Encryption= EncryptionAlgorithm.WinZipAes256
e1.Password= "Top.Secret.No.Peeking!"
zip.Save("EncryptedArchive.zip")
End Using
' Extract a zip archive that uses AES Encryption.
' You do not need to specify the algorithm during extraction.
Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
' Specify the password that is used during extraction, for
' all entries that require a password:
zip.Password= "Top.Secret.No.Peeking!"
zip.ExtractAll("extractDirectory")
End Using
Thrown in the setter if EncryptionAlgorithm.Unsupported is specified.
ZipEntry.Password
ZipFile.Encryption
The Password to be used when encrypting a ZipEntry upon
ZipFile.Save(), or when decrypting an entry upon Extract().
This is a write-only property on the entry. Set this to request that the
entry be encrypted when writing the zip archive, or set it to specify the
password to be used when extracting an existing entry that is encrypted.
The password set here is implicitly used to encrypt the entry during the
operation, or to decrypt during the or operation. If you set
the Password on a ZipEntry after calling Save(), there is no
effect.
Consider setting the property when using a
password. Answering concerns that the standard password protection
supported by all zip tools is weak, WinZip has extended the ZIP
specification with a way to use AES Encryption to protect entries in the
Zip file. Unlike the "PKZIP 2.0" encryption specified in the PKZIP
specification, AES
Encryption uses a standard, strong, tested, encryption
algorithm. DotNetZip can create zip archives that use WinZip-compatible
AES encryption, if you set the property. But,
archives created that use AES encryption may not be readable by all other
tools and libraries. For example, Windows Explorer cannot read a
"compressed folder" (a zip file) that uses AES encryption, though it can
read a zip file that uses "PKZIP encryption."
The class also has a
property. This property takes precedence over any password set on the
ZipFile itself. Typically, you would use the per-entry Password when most
entries in the zip archive use one password, and a few entries use a
different password. If all entries in the zip file use the same password,
then it is simpler to just set this property on the ZipFile itself,
whether creating a zip archive or extracting a zip archive.
Some comments on updating archives: If you read a ZipFile, you
cannot modify the password on any encrypted entry, except by extracting
the entry with the original password (if any), removing the original entry
via , and then adding a new
entry with a new Password.
For example, suppose you read a ZipFile, and there is an encrypted
entry. Setting the Password property on that ZipEntry and then
calling Save() on the ZipFile does not update the password
on that entry in the archive. Neither is an exception thrown. Instead,
what happens during the Save() is the existing entry is copied
through to the new zip archive, in its original encrypted form. Upon
re-reading that archive, the entry can be decrypted with its original
password.
If you read a ZipFile, and there is an un-encrypted entry, you can set the
Password on the entry and then call Save() on the ZipFile, and get
encryption on that entry.
This example creates a zip file with two entries, and then extracts the
entries from the zip file. When creating the zip file, the two files are
added to the zip file using password protection. Each entry uses a
different password. During extraction, each file is extracted with the
appropriate password.
// create a file with encryption
using (ZipFile zip = new ZipFile())
{
ZipEntry entry;
entry= zip.AddFile("Declaration.txt");
entry.Password= "123456!";
entry = zip.AddFile("Report.xls");
entry.Password= "1Secret!";
zip.Save("EncryptedArchive.zip");
}
// extract entries that use encryption
using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
{
ZipEntry entry;
entry = zip["Declaration.txt"];
entry.Password = "123456!";
entry.Extract("extractDir");
entry = zip["Report.xls"];
entry.Password = "1Secret!";
entry.Extract("extractDir");
}
Using zip As New ZipFile
Dim entry as ZipEntry
entry= zip.AddFile("Declaration.txt")
entry.Password= "123456!"
entry = zip.AddFile("Report.xls")
entry.Password= "1Secret!"
zip.Save("EncryptedArchive.zip")
End Using
' extract entries that use encryption
Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
Dim entry as ZipEntry
entry = zip("Declaration.txt")
entry.Password = "123456!"
entry.Extract("extractDir")
entry = zip("Report.xls")
entry.Password = "1Secret!"
entry.Extract("extractDir")
End Using
ZipFile.Password
The action the library should take when extracting a file that already exists.
This property affects the behavior of the Extract methods (one of the
Extract() or ExtractWithPassword() overloads), when
extraction would would overwrite an existing filesystem file. If you do
not set this property, the library throws an exception when extracting
an entry would overwrite an existing file.
This property has no effect when extracting to a stream, or when the file to be
extracted does not already exist.
This example shows how to set the ExtractExistingFile property in
an ExtractProgress event, in response to user input. The
ExtractProgress event is invoked if and only if the
ExtractExistingFile property was previously set to
ExtractExistingFileAction.InvokeExtractProgressEvent.
public static void ExtractProgress(object sender, ExtractProgressEventArgs e)
{
if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
Console.WriteLine("extract {0} ", e.CurrentEntry.FileName);
else if (e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite)
{
ZipEntry entry = e.CurrentEntry;
string response = null;
// Ask the user if he wants overwrite the file
do
{
Console.Write("Overwrite {0} in {1} ? (y/n/C) ", entry.FileName, e.ExtractLocation);
response = Console.ReadLine();
Console.WriteLine();
} while (response != null && response[0]!='Y' &&
response[0]!='N' && response[0]!='C');
if (response[0]=='C')
e.Cancel = true;
else if (response[0]=='Y')
entry.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
else
entry.ExtractExistingFile= ExtractExistingFileAction.DoNotOverwrite;
}
}
The action to take when an error is encountered while
opening or reading files as they are saved into a zip archive.
Errors can occur within a call to ZipFile.Save, as the various files contained
in a ZipFile are being saved into the zip archive. During the
Save, DotNetZip will perform a File.Open on the file
associated to the ZipEntry, and then will read the entire contents of
the file as it is zipped. Either the open or the Read may fail, because
of lock conflicts or other reasons. Using this property, you can
specify the action to take when such errors occur.
Typically you will NOT set this property on individual ZipEntry
instances. Instead, you will set the ZipFile.ZipErrorAction property on
the ZipFile instance, before adding any entries to the
ZipFile. If you do this, errors encountered on behalf of any of
the entries in the ZipFile will be handled the same way.
But, if you use a handler, you will want
to set this property on the ZipEntry within the handler, to
communicate back to DotNetZip what you would like to do with the
particular error.
Indicates whether the entry was included in the most recent save.
An entry can be excluded or skipped from a save if there is an error
opening or reading the entry.
A callback that allows the application to specify the compression to use
for a given entry that is about to be added to the zip archive.
See
Set to indicate whether to use UTF-8 encoding for filenames and comments.
If this flag is set, the comment and filename for the entry will be
encoded with UTF-8, as described in the Zip
specification, if necessary. "Necessary" means, the filename or
entry comment (if any) cannot be reflexively encoded and decoded using the
default code page, IBM437.
Setting this flag to true is equivalent to setting to System.Text.Encoding.UTF8.
This flag has no effect or relation to the text encoding used within the
file itself.
The text encoding to use for the FileName and Comment on this ZipEntry,
when the default encoding is insufficient.
Don't use this property. See .
Specifies the alternate text encoding used by this ZipEntry
The default text encoding used in Zip files for encoding filenames and
comments is IBM437, which is something like a superset of ASCII. In
cases where this is insufficient, applications can specify an
alternate encoding.
When creating a zip file, the usage of the alternate encoding is
governed by the property.
Typically you would set both properties to tell DotNetZip to employ an
encoding that is not IBM437 in the zipfile you are creating.
Keep in mind that because the ZIP specification states that the only
valid encodings to use are IBM437 and UTF-8, if you use something
other than that, then zip tools and libraries may not be able to
successfully read the zip archive you generate.
The zip specification states that applications should presume that
IBM437 is in use, except when a special bit is set, which indicates
UTF-8. There is no way to specify an arbitrary code page, within the
zip file itself. When you create a zip file encoded with gb2312 or
ibm861 or anything other than IBM437 or UTF-8, then the application
that reads the zip file needs to "know" which code page to use. In
some cases, the code page used when reading is chosen implicitly. For
example, WinRar uses the ambient code page for the host desktop
operating system. The pitfall here is that if you create a zip in
Copenhagen and send it to Tokyo, the reader of the zipfile may not be
able to decode successfully.
This example shows how to create a zipfile encoded with a
language-specific encoding:
using (var zip = new ZipFile())
{
zip.AlternateEnoding = System.Text.Encoding.GetEncoding("ibm861");
zip.AlternateEnodingUsage = ZipOption.Always;
zip.AddFileS(arrayOfFiles);
zip.Save("Myarchive-Encoded-in-IBM861.zip");
}
Describes if and when this instance should apply
AlternateEncoding to encode the FileName and Comment, when
saving.
Indicates whether an entry is marked as a text file. Be careful when
using on this property. Unless you have a good reason, you should
probably ignore this property.
The ZIP format includes a provision for specifying whether an entry in
the zip archive is a text or binary file. This property exposes that
metadata item. Be careful when using this property: It's not clear
that this property as a firm meaning, across tools and libraries.
To be clear, when reading a zip file, the property value may or may
not be set, and its value may or may not be valid. Not all entries
that you may think of as "text" entries will be so marked, and entries
marked as "text" are not guaranteed in any way to be text entries.
Whether the value is set and set correctly depends entirely on the
application that produced the zip file.
There are many zip tools available, and when creating zip files, some
of them "respect" the IsText metadata field, and some of them do not.
Unfortunately, even when an application tries to do "the right thing",
it's not always clear what "the right thing" is.
There's no firm definition of just what it means to be "a text file",
and the zip specification does not help in this regard. Twenty years
ago, text was ASCII, each byte was less than 127. IsText meant, all
bytes in the file were less than 127. These days, it is not the case
that all text files have all bytes less than 127. Any unicode file
may have bytes that are above 0x7f. The zip specification has nothing
to say on this topic. Therefore, it's not clear what IsText really
means.
This property merely tells a reading application what is stored in the
metadata for an entry, without guaranteeing its validity or its
meaning.
When DotNetZip is used to create a zipfile, it attempts to set this
field "correctly." For example, if a file ends in ".txt", this field
will be set. Your application may override that default setting. When
writing a zip file, you must set the property before calling
Save() on the ZipFile.
When reading a zip file, a more general way to decide just what kind
of file is contained in a particular entry is to use the file type
database stored in the operating system. The operating system stores
a table that says, a file with .jpg extension is a JPG image file, a
file with a .xml extension is an XML document, a file with a .txt is a
pure ASCII text document, and so on. To get this information on
Windows, you
need to read and parse the registry.
using (var zip = new ZipFile())
{
var e = zip.UpdateFile("Descriptions.mme", "");
e.IsText = true;
zip.Save(zipPath);
}
Using zip As New ZipFile
Dim e2 as ZipEntry = zip.AddFile("Descriptions.mme", "")
e.IsText= True
zip.Save(zipPath)
End Using
Provides a string representation of the instance.
a string representation of the instance.
Extract the entry to the filesystem, starting at the current
working directory.
This method has a bunch of overloads! One of them is sure to
be the right one for you... If you don't like these, check
out the ExtractWithPassword() methods.
This method extracts an entry from a zip file into the current
working directory. The path of the entry as extracted is the full
path as specified in the zip archive, relative to the current
working directory. After the file is extracted successfully, the
file attributes and timestamps are set.
The action taken when extraction an entry would overwrite an
existing file is determined by the property.
Within the call to Extract(), the content for the entry is
written into a filesystem file, and then the last modified time of the
file is set according to the property on
the entry. See the remarks the property for
some details about the last modified time.
Extract the entry to a file in the filesystem, using the specified
behavior when extraction would overwrite an existing file.
See the remarks on the property, for some
details about how the last modified time of the file is set after
extraction.
The action to take if extraction would overwrite an existing file.
Extracts the entry to the specified stream.
The caller can specify any write-able stream, for example a , a , or ASP.NET's
Response.OutputStream. The content will be decrypted and
decompressed as necessary. If the entry is encrypted and no password
is provided, this method will throw.
The position on the stream is not reset by this method before it extracts.
You may want to call stream.Seek() before calling ZipEntry.Extract().
the stream to which the entry should be extracted.
Extract the entry to the filesystem, starting at the specified base
directory.
the pathname of the base directory
This example extracts only the entries in a zip file that are .txt files,
into a directory called "textfiles".
using (ZipFile zip = ZipFile.Read("PackedDocuments.zip"))
{
foreach (string s1 in zip.EntryFilenames)
{
if (s1.EndsWith(".txt"))
{
zip[s1].Extract("textfiles");
}
}
}
Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip")
Dim s1 As String
For Each s1 In zip.EntryFilenames
If s1.EndsWith(".txt") Then
zip(s1).Extract("textfiles")
End If
Next
End Using
Using this method, existing entries in the filesystem will not be
overwritten. If you would like to force the overwrite of existing
files, see the property, or call
.
See the remarks on the property, for some
details about how the last modified time of the created file is set.
Extract the entry to the filesystem, starting at the specified base
directory, and using the specified behavior when extraction would
overwrite an existing file.
See the remarks on the property, for some
details about how the last modified time of the created file is set.
String sZipPath = "Airborne.zip";
String sFilePath = "Readme.txt";
String sRootFolder = "Digado";
using (ZipFile zip = ZipFile.Read(sZipPath))
{
if (zip.EntryFileNames.Contains(sFilePath))
{
// use the string indexer on the zip file
zip[sFileName].Extract(sRootFolder,
ExtractExistingFileAction.OverwriteSilently);
}
}
Dim sZipPath as String = "Airborne.zip"
Dim sFilePath As String = "Readme.txt"
Dim sRootFolder As String = "Digado"
Using zip As ZipFile = ZipFile.Read(sZipPath)
If zip.EntryFileNames.Contains(sFilePath)
' use the string indexer on the zip file
zip(sFilePath).Extract(sRootFolder, _
ExtractExistingFileAction.OverwriteSilently)
End If
End Using
the pathname of the base directory
The action to take if extraction would overwrite an existing file.
Extract the entry to the filesystem, using the current working directory
and the specified password.
This method has a bunch of overloads! One of them is sure to be
the right one for you...
Existing entries in the filesystem will not be overwritten. If you
would like to force the overwrite of existing files, see the property, or call
.
See the remarks on the property for some
details about how the "last modified" time of the created file is
set.
In this example, entries that use encryption are extracted using a
particular password.
using (var zip = ZipFile.Read(FilePath))
{
foreach (ZipEntry e in zip)
{
if (e.UsesEncryption)
e.ExtractWithPassword("Secret!");
else
e.Extract();
}
}
Using zip As ZipFile = ZipFile.Read(FilePath)
Dim e As ZipEntry
For Each e In zip
If (e.UsesEncryption)
e.ExtractWithPassword("Secret!")
Else
e.Extract
End If
Next
End Using
The Password to use for decrypting the entry.
Extract the entry to the filesystem, starting at the specified base
directory, and using the specified password.
Existing entries in the filesystem will not be overwritten. If you
would like to force the overwrite of existing files, see the property, or call
.
See the remarks on the property, for some
details about how the last modified time of the created file is set.
The pathname of the base directory.
The Password to use for decrypting the entry.
Extract the entry to a file in the filesystem, relative to the
current directory, using the specified behavior when extraction
would overwrite an existing file.
See the remarks on the property, for some
details about how the last modified time of the created file is set.
The Password to use for decrypting the entry.
The action to take if extraction would overwrite an existing file.
Extract the entry to the filesystem, starting at the specified base
directory, and using the specified behavior when extraction would
overwrite an existing file.
See the remarks on the property, for some
details about how the last modified time of the created file is set.
the pathname of the base directory
The action to take if extraction would
overwrite an existing file.
The Password to use for decrypting the entry.
Extracts the entry to the specified stream, using the specified
Password. For example, the caller could extract to Console.Out, or
to a MemoryStream.
The caller can specify any write-able stream, for example a , a , or ASP.NET's
Response.OutputStream. The content will be decrypted and
decompressed as necessary. If the entry is encrypted and no password
is provided, this method will throw.
The position on the stream is not reset by this method before it extracts.
You may want to call stream.Seek() before calling ZipEntry.Extract().
the stream to which the entry should be extracted.
The password to use for decrypting the entry.
Opens a readable stream corresponding to the zip entry in the
archive. The stream decompresses and decrypts as necessary, as it
is read.
DotNetZip offers a variety of ways to extract entries from a zip
file. This method allows an application to extract an entry by
reading a .
The return value is of type . Use it as you would any
stream for reading. When an application calls on that stream, it will
receive data from the zip entry that is decrypted and decompressed
as necessary.
CrcCalculatorStream adds one additional feature: it keeps a
CRC32 checksum on the bytes of the stream as it is read. The CRC
value is available in the property on the
CrcCalculatorStream. When the read is complete, your
application
should check this CRC against the
property on the ZipEntry to validate the content of the
ZipEntry. You don't have to validate the entry using the CRC, but
you should, to verify integrity. Check the example for how to do
this.
If the entry is protected with a password, then you need to provide
a password prior to calling , either by
setting the property on the entry, or the
property on the ZipFile
itself. Or, you can use , the
overload of OpenReader that accepts a password parameter.
If you want to extract entry data into a write-able stream that is
already opened, like a , do not
use this method. Instead, use .
Your application may use only one stream created by OpenReader() at
a time, and you should not call other Extract methods before
completing your reads on a stream obtained from OpenReader(). This
is because there is really only one source stream for the compressed
content. A call to OpenReader() seeks in the source stream, to the
beginning of the compressed content. A subsequent call to
OpenReader() on a different entry will seek to a different position
in the source stream, as will a call to Extract() or one of its
overloads. This will corrupt the state for the decompressing stream
from the original call to OpenReader().
The OpenReader() method works only when the ZipEntry is
obtained from an instance of ZipFile. This method will throw
an exception if the ZipEntry is obtained from a ZipInputStream.
This example shows how to open a zip archive, then read in a named
entry via a stream. After the read loop is complete, the code
compares the calculated during the read loop with the expected CRC
on the ZipEntry, to verify the extraction.
using (ZipFile zip = new ZipFile(ZipFileToRead))
{
ZipEntry e1= zip["Elevation.mp3"];
using (Ionic.Zlib.CrcCalculatorStream s = e1.OpenReader())
{
byte[] buffer = new byte[4096];
int n, totalBytesRead= 0;
do {
n = s.Read(buffer,0, buffer.Length);
totalBytesRead+=n;
} while (n>0);
if (s.Crc32 != e1.Crc32)
throw new Exception(string.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32));
if (totalBytesRead != e1.UncompressedSize)
throw new Exception(string.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize));
}
}
Using zip As New ZipFile(ZipFileToRead)
Dim e1 As ZipEntry = zip.Item("Elevation.mp3")
Using s As Ionic.Zlib.CrcCalculatorStream = e1.OpenReader
Dim n As Integer
Dim buffer As Byte() = New Byte(4096) {}
Dim totalBytesRead As Integer = 0
Do
n = s.Read(buffer, 0, buffer.Length)
totalBytesRead = (totalBytesRead + n)
Loop While (n > 0)
If (s.Crc32 <> e1.Crc32) Then
Throw New Exception(String.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32))
End If
If (totalBytesRead <> e1.UncompressedSize) Then
Throw New Exception(String.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize))
End If
End Using
End Using
The Stream for reading.
Opens a readable stream for an encrypted zip entry in the archive.
The stream decompresses and decrypts as necessary, as it is read.
See the documentation on the method for
full details. This overload allows the application to specify a
password for the ZipEntry to be read.
The password to use for decrypting the entry.
The Stream for reading.
Validates that the args are consistent.
Only one of {baseDir, outStream} can be non-null.
If baseDir is non-null, then the outputFile is created.
Reads one ZipEntry from the given stream. The content for
the entry does not get decompressed or decrypted. This method
basically reads metadata, and seeks.
the ZipContainer this entry belongs to.
true of this is the first entry being read from the stream.
the ZipEntry read from the stream.
Finds a particular segment in the given extra field.
This is used when modifying a previously-generated
extra field, in particular when removing the AES crypto
segment in the extra field.
At current cursor position in the stream, read the extra
field, and set the properties on the ZipEntry instance
appropriately. This can be called when processing the
Extra field in the Central Directory, or in the local
header.
generate and return a byte array that encodes the filename
for the entry.
side effects: generate and store into _CommentBytes the
byte array for any comment attached to the entry. Also
sets _actualEncoding to indicate the actual encoding
used. The same encoding is used for both filename and
comment.
Stores the position of the entry source stream, or, if the position is
already stored, seeks to that position.
This method is called in prep for reading the source stream. If PKZIP
encryption is used, then we need to calc the CRC32 before doing the
encryption, because the CRC is used in the 12th byte of the PKZIP
encryption header. So, we need to be able to seek backward in the source
when saving the ZipEntry. This method is called from the place that
calculates the CRC, and also from the method that does the encryption of
the file data.
The first time through, this method sets the _sourceStreamOriginalPosition
field. Subsequent calls to this method seek to that position.
Copy metadata that may have been changed by the app. We do this when
resetting the zipFile instance. If the app calls Save() on a ZipFile, then
tries to party on that file some more, we may need to Reset() it , which
means re-reading the entries and then copying the metadata. I think.
Set the input stream and get its length, if possible. The length is
used for progress updates, AND, to allow an optimization in case of
a stream/file of zero length. In that case we skip the Encrypt and
compression Stream. (like DeflateStream or BZip2OutputStream)
Prepare the given stream for output - wrap it in a CountingStream, and
then in a CRC stream, and an encryptor and deflator as appropriate.
Previously this was used in ZipEntry.Write(), but in an effort to
introduce some efficiencies in that method I've refactored to put the
code inline. This method still gets called by ZipOutputStream.
An enum that specifies the type of timestamp available on the ZipEntry.
The last modified time of a file can be stored in multiple ways in
a zip file, and they are not mutually exclusive:
-
In the so-called "DOS" format, which has a 2-second precision. Values
are rounded to the nearest even second. For example, if the time on the
file is 12:34:43, then it will be stored as 12:34:44. This first value
is accessible via the LastModified property. This value is always
present in the metadata for each zip entry. In some cases the value is
invalid, or zero.
-
In the so-called "Windows" or "NTFS" format, as an 8-byte integer
quantity expressed as the number of 1/10 milliseconds (in other words
the number of 100 nanosecond units) since January 1, 1601 (UTC). This
format is how Windows represents file times. This time is accessible
via the ModifiedTime property.
-
In the "Unix" format, a 4-byte quantity specifying the number of seconds since
January 1, 1970 UTC.
-
In an older format, now deprecated but still used by some current
tools. This format is also a 4-byte quantity specifying the number of
seconds since January 1, 1970 UTC.
This bit field describes which of the formats were found in a ZipEntry that was read.
Default value.
A DOS timestamp with 2-second precision.
A Windows timestamp with 100-ns precision.
A Unix timestamp with 1-second precision.
A Unix timestamp with 1-second precision, stored in InfoZip v1 format. This
format is outdated and is supported for reading archives only.
The method of compression to use for a particular ZipEntry.
PKWare's
ZIP Specification describes a number of distinct
cmopression methods that can be used within a zip
file. DotNetZip supports a subset of them.
No compression at all. For COM environments, the value is 0 (zero).
DEFLATE compression, as described in IETF RFC
1951. This is the "normal" compression used in zip
files. For COM environments, the value is 8.
An enum that specifies the source of the ZipEntry.
Default value. Invalid on a bonafide ZipEntry.
The entry was instantiated by calling AddFile() or another method that
added an entry from the filesystem.
The entry was instantiated via or
.
The ZipEntry was instantiated by reading a zipfile.
The content for the ZipEntry will be or was provided by the WriteDelegate.
The content for the ZipEntry will be obtained from the stream dispensed by the OpenDelegate.
The entry was instantiated via .
The content for the ZipEntry will be or was obtained from a ZipOutputStream.
An enum providing the options when an error occurs during opening or reading
of a file or directory that is being saved to a zip file.
This enum describes the actions that the library can take when an error occurs
opening or reading a file, as it is being saved into a Zip archive.
In some cases an error will occur when DotNetZip tries to open a file to be
added to the zip archive. In other cases, an error might occur after the
file has been successfully opened, while DotNetZip is reading the file.
The first problem might occur when calling AddDirectory() on a directory
that contains a Clipper .dbf file; the file is locked by Clipper and
cannot be opened by another process. An example of the second problem is
the ERROR_LOCK_VIOLATION that results when a file is opened by another
process, but not locked, and a range lock has been taken on the file.
Microsoft Outlook takes range locks on .PST files.
Throw an exception when an error occurs while zipping. This is the default
behavior. (For COM clients, this is a 0 (zero).)
When an error occurs during zipping, for example a file cannot be opened,
skip the file causing the error, and continue zipping. (For COM clients,
this is a 1.)
When an error occurs during zipping, for example a file cannot be opened,
retry the operation that caused the error. Be careful with this option. If
the error is not temporary, the library will retry forever. (For COM
clients, this is a 2.)
When an error occurs, invoke the zipError event. The event type used is
. A typical use of this option:
a GUI application may wish to pop up a dialog to allow the user to view the
error that occurred, and choose an appropriate action. After your
processing in the error event, if you want to skip the file, set on the
ZipProgressEventArgs.CurrentEntry to Skip. If you want the
exception to be thrown, set ZipErrorAction on the CurrentEntry
to Throw. If you want to cancel the zip, set
ZipProgressEventArgs.Cancel to true. Cancelling differs from using
Skip in that a cancel will not save any further entries, if there are any.
(For COM clients, the value of this enum is a 3.)
The ZipFile type represents a zip archive file.
This is the main type in the DotNetZip class library. This class reads and
writes zip files, as defined in the specification
for zip files described by PKWare. The compression for this
implementation is provided by a managed-code version of Zlib, included with
DotNetZip in the classes in the Ionic.Zlib namespace.
This class provides a general purpose zip file capability. Use it to read,
create, or update zip files. When you want to create zip files using a
Stream type to write the zip file, you may want to consider the class.
Both the ZipOutputStream class and the ZipFile class can
be used to create zip files. Both of them support many of the common zip
features, including Unicode, different compression methods and levels,
and ZIP64. They provide very similar performance when creating zip
files.
The ZipFile class is generally easier to use than
ZipOutputStream and should be considered a higher-level interface. For
example, when creating a zip file via calls to the PutNextEntry() and
Write() methods on the ZipOutputStream class, the caller is
responsible for opening the file, reading the bytes from the file, writing
those bytes into the ZipOutputStream, setting the attributes on the
ZipEntry, and setting the created, last modified, and last accessed
timestamps on the zip entry. All of these things are done automatically by a
call to ZipFile.AddFile().
For this reason, the ZipOutputStream is generally recommended for use
only when your application emits arbitrary data, not necessarily data from a
filesystem file, directly into a zip file, and does so using a Stream
metaphor.
Aside from the differences in programming model, there are other
differences in capability between the two classes.
-
ZipFile can be used to read and extract zip files, in addition to
creating zip files. ZipOutputStream cannot read zip files. If you want
to use a stream to read zip files, check out the ZipInputStream class.
-
ZipOutputStream does not support the creation of segmented or spanned
zip files.
-
ZipOutputStream cannot produce a self-extracting archive.
Be aware that the ZipFile class implements the interface. In order for ZipFile to
produce a valid zip file, you use use it within a using clause (Using
in VB), or call the Dispose() method explicitly. See the examples
for how to employ a using clause.
Adds an item, either a file or a directory, to a zip file archive.
This method is handy if you are adding things to zip archive and don't
want to bother distinguishing between directories or files. Any files are
added as single entries. A directory added through this method is added
recursively: all files and subdirectories contained within the directory
are added to the ZipFile.
The name of the item may be a relative path or a fully-qualified
path. Remember, the items contained in ZipFile instance get written
to the disk only when you call or a similar
save method.
The directory name used for the file within the archive is the same
as the directory name (potentially a relative path) specified in the
.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
This method has two overloads.
the name of the file or directory to add.
The ZipEntry added.
Adds an item, either a file or a directory, to a zip file archive,
explicitly specifying the directory path to be used in the archive.
If adding a directory, the add is recursive on all files and
subdirectories contained within it.
The name of the item may be a relative path or a fully-qualified path.
The item added by this call to the ZipFile is not read from the
disk nor written to the zip file archive until the application calls
Save() on the ZipFile.
This version of the method allows the caller to explicitly specify the
directory path to be used in the archive, which would override the
"natural" path of the filesystem file.
Encryption will be used on the file data if the Password has
been set on the ZipFile object, prior to calling this method.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
Thrown if the file or directory passed in does not exist.
the name of the file or directory to add.
The name of the directory path to use within the zip archive. This path
need not refer to an extant directory in the current filesystem. If the
files within the zip are later extracted, this is the path used for the
extracted file. Passing null (Nothing in VB) will use the
path on the fileOrDirectoryName. Passing the empty string ("") will
insert the item at the root path within the archive.
This example shows how to zip up a set of files into a flat hierarchy,
regardless of where in the filesystem the files originated. The resulting
zip archive will contain a toplevel directory named "flat", which itself
will contain files Readme.txt, MyProposal.docx, and Image1.jpg. A
subdirectory under "flat" called SupportFiles will contain all the files
in the "c:\SupportFiles" directory on disk.
String[] itemnames= {
"c:\\fixedContent\\Readme.txt",
"MyProposal.docx",
"c:\\SupportFiles", // a directory
"images\\Image1.jpg"
};
try
{
using (ZipFile zip = new ZipFile())
{
for (int i = 1; i < itemnames.Length; i++)
{
// will add Files or Dirs, recurses and flattens subdirectories
zip.AddItem(itemnames[i],"flat");
}
zip.Save(ZipToCreate);
}
}
catch (System.Exception ex1)
{
System.Console.Error.WriteLine("exception: {0}", ex1);
}
Dim itemnames As String() = _
New String() { "c:\fixedContent\Readme.txt", _
"MyProposal.docx", _
"SupportFiles", _
"images\Image1.jpg" }
Try
Using zip As New ZipFile
Dim i As Integer
For i = 1 To itemnames.Length - 1
' will add Files or Dirs, recursing and flattening subdirectories.
zip.AddItem(itemnames(i), "flat")
Next i
zip.Save(ZipToCreate)
End Using
Catch ex1 As Exception
Console.Error.WriteLine("exception: {0}", ex1.ToString())
End Try
The ZipEntry added.
Adds a File to a Zip file archive.
This call collects metadata for the named file in the filesystem,
including the file attributes and the timestamp, and inserts that metadata
into the resulting ZipEntry. Only when the application calls Save() on
the ZipFile, does DotNetZip read the file from the filesystem and
then write the content to the zip file archive.
This method will throw an exception if an entry with the same name already
exists in the ZipFile.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
In this example, three files are added to a Zip archive. The ReadMe.txt
file will be placed in the root of the archive. The .png file will be
placed in a folder within the zip called photos\personal. The pdf file
will be included into a folder within the zip called Desktop.
try
{
using (ZipFile zip = new ZipFile())
{
zip.AddFile("c:\\photos\\personal\\7440-N49th.png");
zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf");
zip.AddFile("ReadMe.txt");
zip.Save("Package.zip");
}
}
catch (System.Exception ex1)
{
System.Console.Error.WriteLine("exception: " + ex1);
}
Try
Using zip As ZipFile = New ZipFile
zip.AddFile("c:\photos\personal\7440-N49th.png")
zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf")
zip.AddFile("ReadMe.txt")
zip.Save("Package.zip")
End Using
Catch ex1 As Exception
Console.Error.WriteLine("exception: {0}", ex1.ToString)
End Try
This method has two overloads.
The name of the file to add. It should refer to a file in the filesystem.
The name of the file may be a relative path or a fully-qualified path.
The ZipEntry corresponding to the File added.
Adds a File to a Zip file archive, potentially overriding the path to be
used within the zip archive.
The file added by this call to the ZipFile is not written to the
zip file archive until the application calls Save() on the ZipFile.
This method will throw an exception if an entry with the same name already
exists in the ZipFile.
This version of the method allows the caller to explicitly specify the
directory path to be used in the archive.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
In this example, three files are added to a Zip archive. The ReadMe.txt
file will be placed in the root of the archive. The .png file will be
placed in a folder within the zip called images. The pdf file will be
included into a folder within the zip called files\docs, and will be
encrypted with the given password.
try
{
using (ZipFile zip = new ZipFile())
{
// the following entry will be inserted at the root in the archive.
zip.AddFile("c:\\datafiles\\ReadMe.txt", "");
// this image file will be inserted into the "images" directory in the archive.
zip.AddFile("c:\\photos\\personal\\7440-N49th.png", "images");
// the following will result in a password-protected file called
// files\\docs\\2008-Regional-Sales-Report.pdf in the archive.
zip.Password = "EncryptMe!";
zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf", "files\\docs");
zip.Save("Archive.zip");
}
}
catch (System.Exception ex1)
{
System.Console.Error.WriteLine("exception: {0}", ex1);
}
Try
Using zip As ZipFile = New ZipFile
' the following entry will be inserted at the root in the archive.
zip.AddFile("c:\datafiles\ReadMe.txt", "")
' this image file will be inserted into the "images" directory in the archive.
zip.AddFile("c:\photos\personal\7440-N49th.png", "images")
' the following will result in a password-protected file called
' files\\docs\\2008-Regional-Sales-Report.pdf in the archive.
zip.Password = "EncryptMe!"
zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf", "files\documents")
zip.Save("Archive.zip")
End Using
Catch ex1 As Exception
Console.Error.WriteLine("exception: {0}", ex1)
End Try
The name of the file to add. The name of the file may be a relative path
or a fully-qualified path.
Specifies a directory path to use to override any path in the fileName.
This path may, or may not, correspond to a real directory in the current
filesystem. If the files within the zip are later extracted, this is the
path used for the extracted file. Passing null (Nothing in
VB) will use the path on the fileName, if any. Passing the empty string
("") will insert the item at the root path within the archive.
The ZipEntry corresponding to the file added.
This method removes a collection of entries from the ZipFile.
A collection of ZipEntry instances from this zip file to be removed. For
example, you can pass in an array of ZipEntry instances; or you can call
SelectEntries(), and then add or remove entries from that
ICollection<ZipEntry> (ICollection(Of ZipEntry) in VB), and pass
that ICollection to this method.
This method removes a collection of entries from the ZipFile, by name.
A collection of strings that refer to names of entries to be removed
from the ZipFile. For example, you can pass in an array or a
List of Strings that provide the names of entries to be removed.
This method adds a set of files to the ZipFile.
Use this method to add a set of files to the zip archive, in one call.
For example, a list of files received from
System.IO.Directory.GetFiles() can be added to a zip archive in one
call.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to each
ZipEntry added.
The collection of names of the files to add. Each string should refer to a
file in the filesystem. The name of the file may be a relative path or a
fully-qualified path.
This example shows how to create a zip file, and add a few files into it.
String ZipFileToCreate = "archive1.zip";
String DirectoryToZip = "c:\\reports";
using (ZipFile zip = new ZipFile())
{
// Store all files found in the top level directory, into the zip archive.
String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
zip.AddFiles(filenames);
zip.Save(ZipFileToCreate);
}
Dim ZipFileToCreate As String = "archive1.zip"
Dim DirectoryToZip As String = "c:\reports"
Using zip As ZipFile = New ZipFile
' Store all files found in the top level directory, into the zip archive.
Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
zip.AddFiles(filenames)
zip.Save(ZipFileToCreate)
End Using
Adds or updates a set of files in the ZipFile.
Any files that already exist in the archive are updated. Any files that
don't yet exist in the archive are added.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to each
ZipEntry added.
The collection of names of the files to update. Each string should refer to a file in
the filesystem. The name of the file may be a relative path or a fully-qualified path.
Adds a set of files to the ZipFile, using the
specified directory path in the archive.
Any directory structure that may be present in the
filenames contained in the list is "flattened" in the
archive. Each file in the list is added to the archive in
the specified top-level directory.
For ZipFile properties including , , , , , , and , their respective values at the
time of this call will be applied to each ZipEntry added.
The names of the files to add. Each string should refer to
a file in the filesystem. The name of the file may be a
relative path or a fully-qualified path.
Specifies a directory path to use to override any path in the file name.
Th is path may, or may not, correspond to a real directory in the current
filesystem. If the files within the zip are later extracted, this is the
path used for the extracted file. Passing null (Nothing in
VB) will use the path on each of the fileNames, if any. Passing
the empty string ("") will insert the item at the root path within the
archive.
Adds a set of files to the ZipFile, using the specified directory
path in the archive, and preserving the full directory structure in the
filenames.
Think of the as a "root" or
base directory used in the archive for the files that get added. when
is true, the hierarchy of files
found in the filesystem will be placed, with the hierarchy intact,
starting at that root in the archive. When preserveDirHierarchy
is false, the path hierarchy of files is flattned, and the flattened
set of files gets placed in the root within the archive as specified in
directoryPathInArchive.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to each
ZipEntry added.
The names of the files to add. Each string should refer to a file in the
filesystem. The name of the file may be a relative path or a
fully-qualified path.
Specifies a directory path to use as a prefix for each entry name.
This path may, or may not, correspond to a real directory in the current
filesystem. If the files within the zip are later extracted, this is the
path used for the extracted file. Passing null (Nothing in
VB) will use the path on each of the fileNames, if any. Passing
the empty string ("") will insert the item at the root path within the
archive.
whether the entries in the zip archive will reflect the directory
hierarchy that is present in the various filenames. For example, if
includes two paths,
\Animalia\Chordata\Mammalia\Info.txt and
\Plantae\Magnoliophyta\Dicotyledon\Info.txt, then calling this method
with = false will
result in an exception because of a duplicate entry name, while
calling this method with =
true will result in the full direcory paths being included in
the entries added to the ZipFile.
Adds or updates a set of files to the ZipFile, using the specified
directory path in the archive.
Any files that already exist in the archive are updated. Any files that
don't yet exist in the archive are added.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to each
ZipEntry added.
The names of the files to add or update. Each string should refer to a
file in the filesystem. The name of the file may be a relative path or a
fully-qualified path.
Specifies a directory path to use to override any path in the file name.
This path may, or may not, correspond to a real directory in the current
filesystem. If the files within the zip are later extracted, this is the
path used for the extracted file. Passing null (Nothing in
VB) will use the path on each of the fileNames, if any. Passing
the empty string ("") will insert the item at the root path within the
archive.
Adds or Updates a File in a Zip file archive.
This method adds a file to a zip archive, or, if the file already exists
in the zip archive, this method Updates the content of that given filename
in the zip archive. The UpdateFile method might more accurately be
called "AddOrUpdateFile".
Upon success, there is no way for the application to learn whether the file
was added versus updated.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
This example shows how to Update an existing entry in a zipfile. The first
call to UpdateFile adds the file to the newly-created zip archive. The
second call to UpdateFile updates the content for that file in the zip
archive.
using (ZipFile zip1 = new ZipFile())
{
// UpdateFile might more accurately be called "AddOrUpdateFile"
zip1.UpdateFile("MyDocuments\\Readme.txt");
zip1.UpdateFile("CustomerList.csv");
zip1.Comment = "This zip archive has been created.";
zip1.Save("Content.zip");
}
using (ZipFile zip2 = ZipFile.Read("Content.zip"))
{
zip2.UpdateFile("Updates\\Readme.txt");
zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed.";
zip2.Save();
}
Using zip1 As New ZipFile
' UpdateFile might more accurately be called "AddOrUpdateFile"
zip1.UpdateFile("MyDocuments\Readme.txt")
zip1.UpdateFile("CustomerList.csv")
zip1.Comment = "This zip archive has been created."
zip1.Save("Content.zip")
End Using
Using zip2 As ZipFile = ZipFile.Read("Content.zip")
zip2.UpdateFile("Updates\Readme.txt")
zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed."
zip2.Save
End Using
The name of the file to add or update. It should refer to a file in the
filesystem. The name of the file may be a relative path or a
fully-qualified path.
The ZipEntry corresponding to the File that was added or updated.
Adds or Updates a File in a Zip file archive.
This method adds a file to a zip archive, or, if the file already exists
in the zip archive, this method Updates the content of that given filename
in the zip archive.
This version of the method allows the caller to explicitly specify the
directory path to be used in the archive. The entry to be added or
updated is found by using the specified directory path, combined with the
basename of the specified filename.
Upon success, there is no way for the application to learn if the file was
added versus updated.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
The name of the file to add or update. It should refer to a file in the
filesystem. The name of the file may be a relative path or a
fully-qualified path.
Specifies a directory path to use to override any path in the
fileName. This path may, or may not, correspond to a real
directory in the current filesystem. If the files within the zip are
later extracted, this is the path used for the extracted file. Passing
null (Nothing in VB) will use the path on the
fileName, if any. Passing the empty string ("") will insert the
item at the root path within the archive.
The ZipEntry corresponding to the File that was added or updated.
Add or update a directory in a zip archive.
If the specified directory does not exist in the archive, then this method
is equivalent to calling AddDirectory(). If the specified
directory already exists in the archive, then this method updates any
existing entries, and adds any new entries. Any entries that are in the
zip archive but not in the specified directory, are left alone. In other
words, the contents of the zip file will be a union of the previous
contents and the new files.
The path to the directory to be added to the zip archive, or updated in
the zip archive.
The ZipEntry corresponding to the Directory that was added or updated.
Add or update a directory in the zip archive at the specified root
directory in the archive.
If the specified directory does not exist in the archive, then this method
is equivalent to calling AddDirectory(). If the specified
directory already exists in the archive, then this method updates any
existing entries, and adds any new entries. Any entries that are in the
zip archive but not in the specified directory, are left alone. In other
words, the contents of the zip file will be a union of the previous
contents and the new files.
The path to the directory to be added to the zip archive, or updated
in the zip archive.
Specifies a directory path to use to override any path in the
directoryName. This path may, or may not, correspond to a real
directory in the current filesystem. If the files within the zip are
later extracted, this is the path used for the extracted file. Passing
null (Nothing in VB) will use the path on the
directoryName, if any. Passing the empty string ("") will insert
the item at the root path within the archive.
The ZipEntry corresponding to the Directory that was added or updated.
Add or update a file or directory in the zip archive.
This is useful when the application is not sure or does not care if the
item to be added is a file or directory, and does not know or does not
care if the item already exists in the ZipFile. Calling this method
is equivalent to calling RemoveEntry() if an entry by the same name
already exists, followed calling by AddItem().
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
the path to the file or directory to be added or updated.
Add or update a file or directory.
This method is useful when the application is not sure or does not care if
the item to be added is a file or directory, and does not know or does not
care if the item already exists in the ZipFile. Calling this method
is equivalent to calling RemoveEntry(), if an entry by that name
exists, and then calling AddItem().
This version of the method allows the caller to explicitly specify the
directory path to be used for the item being added to the archive. The
entry or entries that are added or updated will use the specified
DirectoryPathInArchive. Extracting the entry from the archive will
result in a file stored in that directory path.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
The path for the File or Directory to be added or updated.
Specifies a directory path to use to override any path in the
itemName. This path may, or may not, correspond to a real
directory in the current filesystem. If the files within the zip are
later extracted, this is the path used for the extracted file. Passing
null (Nothing in VB) will use the path on the
itemName, if any. Passing the empty string ("") will insert the
item at the root path within the archive.
Adds a named entry into the zip archive, taking content for the entry
from a string.
Calling this method creates an entry using the given fileName and
directory path within the archive. There is no need for a file by the
given name to exist in the filesystem; the name is used within the zip
archive only. The content for the entry is encoded using the default text
encoding for the machine, or on Silverlight, using UTF-8.
The content of the file, should it be extracted from the zip.
The name, including any path, to use for the entry within the archive.
The ZipEntry added.
This example shows how to add an entry to the zipfile, using a string as
content for that entry.
string Content = "This string will be the content of the Readme.txt file in the zip archive.";
using (ZipFile zip1 = new ZipFile())
{
zip1.AddFile("MyDocuments\\Resume.doc", "files");
zip1.AddEntry("Readme.txt", Content);
zip1.Comment = "This zip file was created at " + System.DateTime.Now.ToString("G");
zip1.Save("Content.zip");
}
Public Sub Run()
Dim Content As String = "This string will be the content of the Readme.txt file in the zip archive."
Using zip1 As ZipFile = New ZipFile
zip1.AddEntry("Readme.txt", Content)
zip1.AddFile("MyDocuments\Resume.doc", "files")
zip1.Comment = ("This zip file was created at " & DateTime.Now.ToString("G"))
zip1.Save("Content.zip")
End Using
End Sub
Adds a named entry into the zip archive, taking content for the entry
from a string, and using the specified text encoding.
Calling this method creates an entry using the given fileName and
directory path within the archive. There is no need for a file by the
given name to exist in the filesystem; the name is used within the zip
archive only.
The content for the entry, a string value, is encoded using the given
text encoding. A BOM (byte-order-mark) is emitted into the file, if the
Encoding parameter is set for that.
Most Encoding classes support a constructor that accepts a boolean,
indicating whether to emit a BOM or not. For example see .
The name, including any path, to use within the archive for the entry.
The content of the file, should it be extracted from the zip.
The text encoding to use when encoding the string. Be aware: This is
distinct from the text encoding used to encode the fileName, as specified
in .
The ZipEntry added.
Create an entry in the ZipFile using the given Stream
as input. The entry will have the given filename.
The application should provide an open, readable stream; in this case it
will be read during the call to or one of
its overloads.
The passed stream will be read from its current position. If
necessary, callers should set the position in the stream before
calling AddEntry(). This might be appropriate when using this method
with a MemoryStream, for example.
In cases where a large number of streams will be added to the
ZipFile, the application may wish to avoid maintaining all of the
streams open simultaneously. To handle this situation, the application
should use the
overload.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
This example adds a single entry to a ZipFile via a Stream.
String zipToCreate = "Content.zip";
String fileNameInArchive = "Content-From-Stream.bin";
using (System.IO.Stream streamToRead = MyStreamOpener())
{
using (ZipFile zip = new ZipFile())
{
ZipEntry entry= zip.AddEntry(fileNameInArchive, streamToRead);
zip.AddFile("Readme.txt");
zip.Save(zipToCreate); // the stream is read implicitly here
}
}
Dim zipToCreate As String = "Content.zip"
Dim fileNameInArchive As String = "Content-From-Stream.bin"
Using streamToRead as System.IO.Stream = MyStreamOpener()
Using zip As ZipFile = New ZipFile()
Dim entry as ZipEntry = zip.AddEntry(fileNameInArchive, streamToRead)
zip.AddFile("Readme.txt")
zip.Save(zipToCreate) '' the stream is read implicitly, here
End Using
End Using
The name, including any path, which is shown in the zip file for the added
entry.
The input stream from which to grab content for the file
The ZipEntry added.
Add a ZipEntry for which content is written directly by the application.
When the application needs to write the zip entry data, use this
method to add the ZipEntry. For example, in the case that the
application wishes to write the XML representation of a DataSet into
a ZipEntry, the application can use this method to do so.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
About progress events: When using the WriteDelegate, DotNetZip does
not issue any SaveProgress events with EventType =
Saving_EntryBytesRead. (This is because it is the
application's code that runs in WriteDelegate - there's no way for
DotNetZip to know when to issue a EntryBytesRead event.)
Applications that want to update a progress bar or similar status
indicator should do so from within the WriteDelegate
itself. DotNetZip will issue the other SaveProgress events,
including
Saving_Started,
Saving_BeforeWriteEntry, and
Saving_AfterWriteEntry.
Note: When you use PKZip encryption, it's normally necessary to
compute the CRC of the content to be encrypted, before compressing or
encrypting it. Therefore, when using PKZip encryption with a
WriteDelegate, the WriteDelegate CAN BE called twice: once to compute
the CRC, and the second time to potentially compress and
encrypt. Surprising, but true. This is because PKWARE specified that
the encryption initialization data depends on the CRC.
If this happens, for each call of the delegate, your
application must stream the same entry data in its entirety. If your
application writes different data during the second call, it will
result in a corrupt zip file.
The double-read behavior happens with all types of entries, not only
those that use WriteDelegate. It happens if you add an entry from a
filesystem file, or using a string, or a stream, or an opener/closer
pair. But in those cases, DotNetZip takes care of reading twice; in
the case of the WriteDelegate, the application code gets invoked
twice. Be aware.
As you can imagine, this can cause performance problems for large
streams, and it can lead to correctness problems when you use a
WriteDelegate. This is a pretty big pitfall. There are two
ways to avoid it. First, and most preferred: don't use PKZIP
encryption. If you use the WinZip AES encryption, this problem
doesn't occur, because the encryption protocol doesn't require the CRC
up front. Second: if you do choose to use PKZIP encryption, write out
to a non-seekable stream (like standard output, or the
Response.OutputStream in an ASP.NET application). In this case,
DotNetZip will use an alternative encryption protocol that does not
rely on the CRC of the content. This also implies setting bit 3 in
the zip entry, which still presents problems for some zip tools.
In the future I may modify DotNetZip to *always* use bit 3 when PKZIP
encryption is in use. This seems like a win overall, but there will
be some work involved. If you feel strongly about it, visit the
DotNetZip forums and vote up the Workitem
tracking this issue.
the name of the entry to add
the delegate which will write the entry content
the ZipEntry added
This example shows an application filling a DataSet, then saving the
contents of that DataSet as XML, into a ZipEntry in a ZipFile, using an
anonymous delegate in C#. The DataSet XML is never saved to a disk file.
var c1= new System.Data.SqlClient.SqlConnection(connstring1);
var da = new System.Data.SqlClient.SqlDataAdapter()
{
SelectCommand= new System.Data.SqlClient.SqlCommand(strSelect, c1)
};
DataSet ds1 = new DataSet();
da.Fill(ds1, "Invoices");
using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
{
zip.AddEntry(zipEntryName, (name,stream) => ds1.WriteXml(stream) );
zip.Save(zipFileName);
}
This example uses an anonymous method in C# as the WriteDelegate to provide
the data for the ZipEntry. The example is a bit contrived - the
AddFile() method is a simpler way to insert the contents of a file
into an entry in a zip file. On the other hand, if there is some sort of
processing or transformation of the file contents required before writing,
the application could use the WriteDelegate to do it, in this way.
using (var input = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ))
{
using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
{
zip.AddEntry(zipEntryName, (name,output) =>
{
byte[] buffer = new byte[BufferSize];
int n;
while ((n = input.Read(buffer, 0, buffer.Length)) != 0)
{
// could transform the data here...
output.Write(buffer, 0, n);
// could update a progress bar here
}
});
zip.Save(zipFileName);
}
}
This example uses a named delegate in VB to write data for the given
ZipEntry (VB9 does not have anonymous delegates). The example here is a bit
contrived - a simpler way to add the contents of a file to a ZipEntry is to
simply use the appropriate AddFile() method. The key scenario for
which the WriteDelegate makes sense is saving a DataSet, in XML
format, to the zip file. The DataSet can write XML to a stream, and the
WriteDelegate is the perfect place to write into the zip file. There may be
other data structures that can write to a stream, but cannot be read as a
stream. The WriteDelegate would be appropriate for those cases as
well.
Private Sub WriteEntry (ByVal name As String, ByVal output As Stream)
Using input As FileStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim n As Integer = -1
Dim buffer As Byte() = New Byte(BufferSize){}
Do While n <> 0
n = input.Read(buffer, 0, buffer.Length)
output.Write(buffer, 0, n)
Loop
End Using
End Sub
Public Sub Run()
Using zip = New ZipFile
zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry))
zip.Save(zipFileName)
End Using
End Sub
Add an entry, for which the application will provide a stream
containing the entry data, on a just-in-time basis.
In cases where the application wishes to open the stream that
holds the content for the ZipEntry, on a just-in-time basis, the
application can use this method. The application provides an
opener delegate that will be called by the DotNetZip library to
obtain a readable stream that can be read to get the bytes for
the given entry. Typically, this delegate opens a stream.
Optionally, the application can provide a closer delegate as
well, which will be called by DotNetZip when all bytes have been
read from the entry.
These delegates are called from within the scope of the call to
ZipFile.Save().
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
This example uses anonymous methods in C# to open and close the
source stream for the content for a zip entry.
using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
{
zip.AddEntry(zipEntryName,
(name) => File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ),
(name, stream) => stream.Close()
);
zip.Save(zipFileName);
}
This example uses delegates in VB.NET to open and close the
the source stream for the content for a zip entry. VB 9.0 lacks
support for "Sub" lambda expressions, and so the CloseDelegate must
be an actual, named Sub.
Function MyStreamOpener(ByVal entryName As String) As Stream
'' This simply opens a file. You probably want to do somethinig
'' more involved here: open a stream to read from a database,
'' open a stream on an HTTP connection, and so on.
Return File.OpenRead(entryName)
End Function
Sub MyStreamCloser(entryName As String, stream As Stream)
stream.Close()
End Sub
Public Sub Run()
Dim dirToZip As String = "fodder"
Dim zipFileToCreate As String = "Archive.zip"
Dim opener As OpenDelegate = AddressOf MyStreamOpener
Dim closer As CloseDelegate = AddressOf MyStreamCloser
Dim numFilestoAdd As Int32 = 4
Using zip As ZipFile = New ZipFile
Dim i As Integer
For i = 0 To numFilesToAdd - 1
zip.AddEntry(String.Format("content-{0:000}.txt"), opener, closer)
Next i
zip.Save(zipFileToCreate)
End Using
End Sub
the name of the entry to add
the delegate that will be invoked by ZipFile.Save() to get the
readable stream for the given entry. ZipFile.Save() will call
read on this stream to obtain the data for the entry. This data
will then be compressed and written to the newly created zip
file.
the delegate that will be invoked to close the stream. This may
be null (Nothing in VB), in which case no call is makde to close
the stream.
the ZipEntry added
Updates the given entry in the ZipFile, using the given
string as content for the ZipEntry.
Calling this method is equivalent to removing the ZipEntry for
the given file name and directory path, if it exists, and then calling
. See the documentation for
that method for further explanation. The string content is encoded
using the default encoding for the machine, or on Silverlight, using
UTF-8. This encoding is distinct from the encoding used for the
filename itself. See .
The name, including any path, to use within the archive for the entry.
The content of the file, should it be extracted from the zip.
The ZipEntry added.
Updates the given entry in the ZipFile, using the given string as
content for the ZipEntry.
Calling this method is equivalent to removing the ZipEntry for the
given file name and directory path, if it exists, and then calling . See the
documentation for that method for further explanation.
The name, including any path, to use within the archive for the entry.
The content of the file, should it be extracted from the zip.
The text encoding to use when encoding the string. Be aware: This is
distinct from the text encoding used to encode the filename. See .
The ZipEntry added.
Updates the given entry in the ZipFile, using the given delegate
as the source for content for the ZipEntry.
Calling this method is equivalent to removing the ZipEntry for the
given file name and directory path, if it exists, and then calling . See the
documentation for that method for further explanation.
The name, including any path, to use within the archive for the entry.
the delegate which will write the entry content.
The ZipEntry added.
Updates the given entry in the ZipFile, using the given delegates
to open and close the stream that provides the content for the ZipEntry.
Calling this method is equivalent to removing the ZipEntry for the
given file name and directory path, if it exists, and then calling . See the
documentation for that method for further explanation.
The name, including any path, to use within the archive for the entry.
the delegate that will be invoked to open the stream
the delegate that will be invoked to close the stream
The ZipEntry added or updated.
Updates the given entry in the ZipFile, using the given stream as
input, and the given filename and given directory Path.
Calling the method is equivalent to calling RemoveEntry() if an
entry by the same name already exists, and then calling AddEntry()
with the given fileName and stream.
The stream must be open and readable during the call to
ZipFile.Save. You can dispense the stream on a just-in-time basis
using the property. Check the
documentation of that property for more information.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to the
ZipEntry added.
The name, including any path, to use within the archive for the entry.
The input stream from which to read file data.
The ZipEntry added.
Add an entry into the zip archive using the given filename and
directory path within the archive, and the given content for the
file. No file is created in the filesystem.
The data to use for the entry.
The name, including any path, to use within the archive for the entry.
The ZipEntry added.
Updates the given entry in the ZipFile, using the given byte
array as content for the entry.
Calling this method is equivalent to removing the ZipEntry
for the given filename and directory path, if it exists, and then
calling . See the
documentation for that method for further explanation.
The name, including any path, to use within the archive for the entry.
The content to use for the ZipEntry.
The ZipEntry added.
Adds the contents of a filesystem directory to a Zip file archive.
The name of the directory may be a relative path or a fully-qualified
path. Any files within the named directory are added to the archive. Any
subdirectories within the named directory are also added to the archive,
recursively.
Top-level entries in the named directory will appear as top-level entries
in the zip archive. Entries in subdirectories in the named directory will
result in entries in subdirectories in the zip archive.
If you want the entries to appear in a containing directory in the zip
archive itself, then you should call the AddDirectory() overload that
allows you to explicitly specify a directory path for use in the archive.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to each
ZipEntry added.
This method has 2 overloads.
The name of the directory to add.
The ZipEntry added.
Adds the contents of a filesystem directory to a Zip file archive,
overriding the path to be used for entries in the archive.
The name of the directory may be a relative path or a fully-qualified
path. The add operation is recursive, so that any files or subdirectories
within the name directory are also added to the archive.
Top-level entries in the named directory will appear as top-level entries
in the zip archive. Entries in subdirectories in the named directory will
result in entries in subdirectories in the zip archive.
For ZipFile properties including , , , , ,
, and , their
respective values at the time of this call will be applied to each
ZipEntry added.
In this code, calling the ZipUp() method with a value of "c:\reports" for
the directory parameter will result in a zip file structure in which all
entries are contained in a toplevel "reports" directory.
public void ZipUp(string targetZip, string directory)
{
using (var zip = new ZipFile())
{
zip.AddDirectory(directory, System.IO.Path.GetFileName(directory));
zip.Save(targetZip);
}
}
The name of the directory to add.
Specifies a directory path to use to override any path in the
DirectoryName. This path may, or may not, correspond to a real directory
in the current filesystem. If the zip is later extracted, this is the
path used for the extracted file or directory. Passing null
(Nothing in VB) or the empty string ("") will insert the items at
the root path within the archive.
The ZipEntry added.
Creates a directory in the zip archive.
Use this when you want to create a directory in the archive but there is
no corresponding filesystem representation for that directory.
You will probably not need to do this in your code. One of the only times
you will want to do this is if you want an empty directory in the zip
archive. The reason: if you add a file to a zip archive that is stored
within a multi-level directory, all of the directory tree is implicitly
created in the zip archive.
The name of the directory to create in the archive.
The ZipEntry added.
Checks a zip file to see if its directory is consistent.
In cases of data error, the directory within a zip file can get out
of synch with the entries in the zip file. This method checks the
given zip file and returns true if this has occurred.
This method may take a long time to run for large zip files.
This method is not supported in the Reduced or Compact Framework
versions of DotNetZip.
Developers using COM can use the ComHelper.CheckZip(String)
method.
The filename to of the zip file to check.
true if the named zip file checks OK. Otherwise, false.
Checks a zip file to see if its directory is consistent,
and optionally fixes the directory if necessary.
In cases of data error, the directory within a zip file can get out of
synch with the entries in the zip file. This method checks the given
zip file, and returns true if this has occurred. It also optionally
fixes the zipfile, saving the fixed copy in Name_Fixed.zip.
This method may take a long time to run for large zip files. It
will take even longer if the file actually needs to be fixed, and if
fixIfNecessary is true.
This method is not supported in the Reduced or Compact
Framework versions of DotNetZip.
The filename to of the zip file to check.
If true, the method will fix the zip file if
necessary.
a TextWriter in which messages generated while checking will be written.
true if the named zip is OK; false if the file needs to be fixed.
Rewrite the directory within a zipfile.
In cases of data error, the directory in a zip file can get out of
synch with the entries in the zip file. This method attempts to fix
the zip file if this has occurred.
This can take a long time for large zip files.
This won't work if the zip file uses a non-standard
code page - neither IBM437 nor UTF-8.
This method is not supported in the Reduced or Compact Framework
versions of DotNetZip.
Developers using COM can use the ComHelper.FixZipDirectory(String)
method.
The filename to of the zip file to fix.
Verify the password on a zip file.
Keep in mind that passwords in zipfiles are applied to
zip entries, not to the entire zip file. So testing a
zipfile for a particular password doesn't work in the
general case. On the other hand, it's often the case
that a single password will be used on all entries in a
zip file. This method works for that case.
There is no way to check a password without doing the
decryption. So this code decrypts and extracts the given
zipfile into
The filename to of the zip file to fix.
The password to check.
a bool indicating whether the password matches.
Provides a human-readable string with information about the ZipFile.
The information string contains 10 lines or so, about each ZipEntry,
describing whether encryption is in use, the compressed and uncompressed
length of the entry, the offset of the entry, and so on. As a result the
information string can be very long for zip files that contain many
entries.
This information is mostly useful for diagnostic purposes.
Indicates whether to perform a full scan of the zip file when reading it.
You almost never want to use this property.
When reading a zip file, if this flag is true (True in
VB), the entire zip archive will be scanned and searched for entries.
For large archives, this can take a very, long time. The much more
efficient default behavior is to read the zip directory, which is
stored at the end of the zip file. But, in some cases the directory is
corrupted and you need to perform a full scan of the zip file to
determine the contents of the zip file. This property lets you do
that, when necessary.
This flag is effective only when calling . Normally you would read a ZipFile with the
static ZipFile.Read
method. But you can't set the FullScan property on the
ZipFile instance when you use a static factory method like
ZipFile.Read.
This example shows how to read a zip file using the full scan approach,
and then save it, thereby producing a corrected zip file.
using (var zip = new ZipFile())
{
zip.FullScan = true;
zip.Initialize(zipFileName);
zip.Save(newName);
}
Using zip As New ZipFile
zip.FullScan = True
zip.Initialize(zipFileName)
zip.Save(newName)
End Using
Whether to sort the ZipEntries before saving the file.
The default is false. If you have a large number of zip entries, the sort
alone can consume significant time.
using (var zip = new ZipFile())
{
zip.AddFiles(filesToAdd);
zip.SortEntriesBeforeSaving = true;
zip.Save(name);
}
Using zip As New ZipFile
zip.AddFiles(filesToAdd)
zip.SortEntriesBeforeSaving = True
zip.Save(name)
End Using
Indicates whether NTFS Reparse Points, like junctions, should be
traversed during calls to AddDirectory().
By default, calls to AddDirectory() will traverse NTFS reparse
points, like mounted volumes, and directory junctions. An example
of a junction is the "My Music" directory in Windows Vista. In some
cases you may not want DotNetZip to traverse those directories. In
that case, set this property to false.
using (var zip = new ZipFile())
{
zip.AddDirectoryWillTraverseReparsePoints = false;
zip.AddDirectory(dirToZip,"fodder");
zip.Save(zipFileToCreate);
}
Size of the IO buffer used while saving.
First, let me say that you really don't need to bother with this. It is
here to allow for optimizations that you probably won't make! It will work
fine if you don't set or get this property at all. Ok?
Now that we have that out of the way, the fine print: This
property affects the size of the buffer that is used for I/O for each
entry contained in the zip file. When a file is read in to be compressed,
it uses a buffer given by the size here. When you update a zip file, the
data for unmodified entries is copied from the first zip file to the
other, through a buffer given by the size here.
Changing the buffer size affects a few things: first, for larger buffer
sizes, the memory used by the ZipFile, obviously, will be larger
during I/O operations. This may make operations faster for very much
larger files. Last, for any given entry, when you use a larger buffer
there will be fewer progress events during I/O operations, because there's
one progress event generated for each time the buffer is filled and then
emptied.
The default buffer size is 8k. Increasing the buffer size may speed
things up as you compress larger files. But there are no hard-and-fast
rules here, eh? You won't know til you test it. And there will be a
limit where ever larger buffers actually slow things down. So as I said
in the beginning, it's probably best if you don't set or get this property
at all.
This example shows how you might set a large buffer size for efficiency when
dealing with zip entries that are larger than 1gb.
using (ZipFile zip = new ZipFile())
{
zip.SaveProgress += this.zip1_SaveProgress;
zip.AddDirectory(directoryToZip, "");
zip.UseZip64WhenSaving = Zip64Option.Always;
zip.BufferSize = 65536*8; // 65536 * 8 = 512k
zip.Save(ZipFileToCreate);
}
Size of the work buffer to use for the ZLIB codec during compression.
When doing ZLIB or Deflate compression, the library fills a buffer,
then passes it to the compressor for compression. Then the library
reads out the compressed bytes. This happens repeatedly until there
is no more uncompressed data to compress. This property sets the
size of the buffer that will be used for chunk-wise compression. In
order for the setting to take effect, your application needs to set
this property before calling one of the ZipFile.Save()
overloads.
Setting this affects the performance and memory efficiency of
compression and decompression. For larger files, setting this to a
larger size may improve compression performance, but the exact
numbers vary depending on available memory, the size of the streams
you are compressing, and a bunch of other variables. I don't have
good firm recommendations on how to set it. You'll have to test it
yourself. Or just leave it alone and accept the default.
Indicates whether extracted files should keep their paths as
stored in the zip archive.
This property affects Extraction. It is not used when creating zip
archives.
With this property set to false, the default, extracting entries
from a zip file will create files in the filesystem that have the full
path associated to the entry within the zip file. With this property set
to true, extracting entries from the zip file results in files
with no path: the folders are "flattened."
An example: suppose the zip file contains entries /directory1/file1.txt and
/directory2/file2.txt. With FlattenFoldersOnExtract set to false,
the files created will be \directory1\file1.txt and \directory2\file2.txt.
With the property set to true, the files created are file1.txt and file2.txt.
The compression strategy to use for all entries.
Set the Strategy used by the ZLIB-compatible compressor, when
compressing entries using the DEFLATE method. Different compression
strategies work better on different sorts of data. The strategy
parameter can affect the compression ratio and the speed of
compression but not the correctness of the compresssion. For more
information see Ionic.Zlib.CompressionStrategy.
The name of the ZipFile, on disk.
When the ZipFile instance was created by reading an archive using
one of the ZipFile.Read methods, this property represents the name
of the zip file that was read. When the ZipFile instance was
created by using the no-argument constructor, this value is null
(Nothing in VB).
If you use the no-argument constructor, and you then explicitly set this
property, when you call , this name will
specify the name of the zip file created. Doing so is equivalent to
calling . When instantiating a
ZipFile by reading from a stream or byte array, the Name
property remains null. When saving to a stream, the Name
property is implicitly set to null.
Sets the compression level to be used for entries subsequently added to
the zip archive.
Varying the compression level used on entries can affect the
size-vs-speed tradeoff when compression and decompressing data streams
or files.
As with some other properties on the ZipFile class, like , , and , setting this property on a ZipFile
instance will cause the specified CompressionLevel to be used on all
items that are subsequently added to the
ZipFile instance. If you set this property after you have added
items to the ZipFile, but before you have called Save(),
those items will not use the specified compression level.
If you do not set this property, the default compression level is used,
which normally gives a good balance of compression efficiency and
compression speed. In some tests, using BestCompression can
double the time it takes to compress, while delivering just a small
increase in compression efficiency. This behavior will vary with the
type of data you compress. If you are in doubt, just leave this setting
alone, and accept the default.
The compression method for the zipfile.
By default, the compression method is CompressionMethod.Deflate.
A comment attached to the zip archive.
This property is read/write. It allows the application to specify a
comment for the ZipFile, or read the comment for the
ZipFile. After setting this property, changes are only made
permanent when you call a Save() method.
According to PKWARE's
zip specification, the comment is not encrypted, even if there is a
password set on the zip file.
The specification does not describe how to indicate the encoding used
on a comment string. Many "compliant" zip tools and libraries use
IBM437 as the code page for comments; DotNetZip, too, follows that
practice. On the other hand, there are situations where you want a
Comment to be encoded with something else, for example using code page
950 "Big-5 Chinese". To fill that need, DotNetZip will encode the
comment following the same procedure it follows for encoding
filenames: (a) if is
Never, it uses the default encoding (IBM437). (b) if is Always, it always uses the
alternate encoding (). (c) if is AsNecessary, it uses the
alternate encoding only if the default encoding is not sufficient for
encoding the comment - in other words if decoding the result does not
produce the original string. This decision is taken at the time of
the call to ZipFile.Save().
When creating a zip archive using this library, it is possible to change
the value of between each
entry you add, and between adding entries and the call to
Save(). Don't do this. It will likely result in a zip file that is
not readable by any tool or application. For best interoperability, leave
alone, or specify it only
once, before adding any entries to the ZipFile instance.
Specifies whether the Creation, Access, and Modified times for entries
added to the zip file will be emitted in Windows format
when the zip archive is saved.
An application creating a zip archive can use this flag to explicitly
specify that the file times for the entries should or should not be stored
in the zip archive in the format used by Windows. By default this flag is
true, meaning the Windows-format times are stored in the zip
archive.
When adding an entry from a file or directory, the Creation (), Access (), and Modified () times for the given entry are
automatically set from the filesystem values. When adding an entry from a
stream or string, all three values are implicitly set to
DateTime.Now. Applications can also explicitly set those times by
calling .
PKWARE's
zip specification describes multiple ways to format these times in a
zip file. One is the format Windows applications normally use: 100ns ticks
since January 1, 1601 UTC. The other is a format Unix applications typically
use: seconds since January 1, 1970 UTC. Each format can be stored in an
"extra field" in the zip entry when saving the zip archive. The former
uses an extra field with a Header Id of 0x000A, while the latter uses a
header ID of 0x5455, although you probably don't need to know that.
Not all tools and libraries can interpret these fields. Windows
compressed folders is one that can read the Windows Format timestamps,
while I believe the Infozip
tools can read the Unix format timestamps. Some tools and libraries
may be able to read only one or the other. DotNetZip can read or write
times in either or both formats.
The times stored are taken from , , and .
The value set here applies to all entries subsequently added to the
ZipFile.
This property is not mutually exclusive of the property. It is possible and
legal and valid to produce a zip file that contains timestamps encoded in
the Unix format as well as in the Windows format, in addition to the LastModified time attached to each
entry in the archive, a time that is always stored in "DOS format". And,
notwithstanding the names PKWare uses for these time formats, any of them
can be read and written by any computer, on any operating system. But,
there are no guarantees that a program running on Mac or Linux will
gracefully handle a zip file with "Windows" formatted times, or that an
application that does not use DotNetZip but runs on Windows will be able to
handle file times in Unix format.
When in doubt, test. Sorry, I haven't got a complete list of tools and
which sort of timestamps they can use and will tolerate. If you get any
good information and would like to pass it on, please do so and I will
include that information in this documentation.
This example shows how to save a zip file that contains file timestamps
in a format normally used by Unix.
using (var zip = new ZipFile())
{
// produce a zip file the Mac will like
zip.EmitTimesInWindowsFormatWhenSaving = false;
zip.EmitTimesInUnixFormatWhenSaving = true;
zip.AddDirectory(directoryToZip, "files");
zip.Save(outputFile);
}
Using zip As New ZipFile
'' produce a zip file the Mac will like
zip.EmitTimesInWindowsFormatWhenSaving = False
zip.EmitTimesInUnixFormatWhenSaving = True
zip.AddDirectory(directoryToZip, "files")
zip.Save(outputFile)
End Using
Specifies whether the Creation, Access, and Modified times
for entries added to the zip file will be emitted in "Unix(tm)
format" when the zip archive is saved.
An application creating a zip archive can use this flag to explicitly
specify that the file times for the entries should or should not be stored
in the zip archive in the format used by Unix. By default this flag is
false, meaning the Unix-format times are not stored in the zip
archive.
When adding an entry from a file or directory, the Creation (), Access (), and Modified () times for the given entry are
automatically set from the filesystem values. When adding an entry from a
stream or string, all three values are implicitly set to DateTime.Now.
Applications can also explicitly set those times by calling .
PKWARE's
zip specification describes multiple ways to format these times in a
zip file. One is the format Windows applications normally use: 100ns ticks
since January 1, 1601 UTC. The other is a format Unix applications
typically use: seconds since January 1, 1970 UTC. Each format can be
stored in an "extra field" in the zip entry when saving the zip
archive. The former uses an extra field with a Header Id of 0x000A, while
the latter uses a header ID of 0x5455, although you probably don't need to
know that.
Not all tools and libraries can interpret these fields. Windows
compressed folders is one that can read the Windows Format timestamps,
while I believe the Infozip
tools can read the Unix format timestamps. Some tools and libraries may be
able to read only one or the other. DotNetZip can read or write times in
either or both formats.
The times stored are taken from , , and .
This property is not mutually exclusive of the property. It is possible and
legal and valid to produce a zip file that contains timestamps encoded in
the Unix format as well as in the Windows format, in addition to the LastModified time attached to each
entry in the zip archive, a time that is always stored in "DOS
format". And, notwithstanding the names PKWare uses for these time
formats, any of them can be read and written by any computer, on any
operating system. But, there are no guarantees that a program running on
Mac or Linux will gracefully handle a zip file with "Windows" formatted
times, or that an application that does not use DotNetZip but runs on
Windows will be able to handle file times in Unix format.
When in doubt, test. Sorry, I haven't got a complete list of tools and
which sort of timestamps they can use and will tolerate. If you get any
good information and would like to pass it on, please do so and I will
include that information in this documentation.
Indicates whether verbose output is sent to the during AddXxx() and
ReadXxx() operations.
This is a synthetic property. It returns true if the is non-null.
Returns true if an entry by the given name exists in the ZipFile.
the name of the entry to find
true if an entry with the given name exists; otherwise false.
Indicates whether to perform case-sensitive matching on the filename when
retrieving entries in the zipfile via the string-based indexer.
The default value is false, which means don't do case-sensitive
matching. In other words, retrieving zip["ReadMe.Txt"] is the same as
zip["readme.txt"]. It really makes sense to set this to true only
if you are not running on Windows, which has case-insensitive
filenames. But since this library is not built for non-Windows platforms,
in most cases you should just leave this property alone.
Indicates whether to encode entry filenames and entry comments using Unicode
(UTF-8).
The
PKWare zip specification provides for encoding file names and file
comments in either the IBM437 code page, or in UTF-8. This flag selects
the encoding according to that specification. By default, this flag is
false, and filenames and comments are encoded into the zip file in the
IBM437 codepage. Setting this flag to true will specify that filenames
and comments that cannot be encoded with IBM437 will be encoded with
UTF-8.
Zip files created with strict adherence to the PKWare specification with
respect to UTF-8 encoding can contain entries with filenames containing
any combination of Unicode characters, including the full range of
characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other
alphabets. However, because at this time, the UTF-8 portion of the PKWare
specification is not broadly supported by other zip libraries and
utilities, such zip files may not be readable by your favorite zip tool or
archiver. In other words, interoperability will decrease if you set this
flag to true.
In particular, Zip files created with strict adherence to the PKWare
specification with respect to UTF-8 encoding will not work well with
Explorer in Windows XP or Windows Vista, because Windows compressed
folders, as far as I know, do not support UTF-8 in zip files. Vista can
read the zip files, but shows the filenames incorrectly. Unpacking from
Windows Vista Explorer will result in filenames that have rubbish
characters in place of the high-order UTF-8 bytes.
Also, zip files that use UTF-8 encoding will not work well with Java
applications that use the java.util.zip classes, as of v5.0 of the Java
runtime. The Java runtime does not correctly implement the PKWare
specification in this regard.
As a result, we have the unfortunate situation that "correct" behavior by
the DotNetZip library with regard to Unicode encoding of filenames during
zip creation will result in zip files that are readable by strictly
compliant and current tools (for example the most recent release of the
commercial WinZip tool); but these zip files will not be readable by
various other tools or libraries, including Windows Explorer.
The DotNetZip library can read and write zip files with UTF8-encoded
entries, according to the PKware spec. If you use DotNetZip for both
creating and reading the zip file, and you use UTF-8, there will be no
loss of information in the filenames. For example, using a self-extractor
created by this library will allow you to unpack files correctly with no
loss of information in the filenames.
If you do not set this flag, it will remain false. If this flag is false,
your ZipFile will encode all filenames and comments using the
IBM437 codepage. This can cause "loss of information" on some filenames,
but the resulting zipfile will be more interoperable with other
utilities. As an example of the loss of information, diacritics can be
lost. The o-tilde character will be down-coded to plain o. The c with a
cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c.
Likewise, the O-stroke character (Unicode 248), used in Danish and
Norwegian, will be down-coded to plain o. Chinese characters cannot be
represented in codepage IBM437; when using the default encoding, Chinese
characters in filenames will be represented as ?. These are all examples
of "information loss".
The loss of information associated to the use of the IBM437 encoding is
inconvenient, and can also lead to runtime errors. For example, using
IBM437, any sequence of 4 Chinese characters will be encoded as ????. If
your application creates a ZipFile, then adds two files, each with
names of four Chinese characters each, this will result in a duplicate
filename exception. In the case where you add a single file with a name
containing four Chinese characters, calling Extract() on the entry that
has question marks in the filename will result in an exception, because
the question mark is not legal for use within filenames on Windows. These
are just a few examples of the problems associated to loss of information.
This flag is independent of the encoding of the content within the entries
in the zip file. Think of the zip file as a container - it supports an
encoding. Within the container are other "containers" - the file entries
themselves. The encoding within those entries is independent of the
encoding of the zip archive container for those entries.
Rather than specify the encoding in a binary fashion using this flag, an
application can specify an arbitrary encoding via the property. Setting the encoding
explicitly when creating zip archives will result in non-compliant zip
files that, curiously, are fairly interoperable. The challenge is, the
PKWare specification does not provide for a way to specify that an entry
in a zip archive uses a code page that is neither IBM437 nor UTF-8.
Therefore if you set the encoding explicitly when creating a zip archive,
you must take care upon reading the zip archive to use the same code page.
If you get it wrong, the behavior is undefined and may result in incorrect
filenames, exceptions, stomach upset, hair loss, and acne.
Specify whether to use ZIP64 extensions when saving a zip archive.
When creating a zip file, the default value for the property is . is
safest, in the sense that you will not get an Exception if a pre-ZIP64
limit is exceeded.
You may set the property at any time before calling Save().
When reading a zip file via the Zipfile.Read() method, DotNetZip
will properly read ZIP64-endowed zip archives, regardless of the value of
this property. DotNetZip will always read ZIP64 archives. This property
governs only whether DotNetZip will write them. Therefore, when updating
archives, be careful about setting this property after reading an archive
that may use ZIP64 extensions.
An interesting question is, if you have set this property to
AsNecessary, and then successfully saved, does the resulting
archive use ZIP64 extensions or not? To learn this, check the property, after calling Save().
Have you thought about
donating?
Indicates whether the archive requires ZIP64 extensions.
This property is null (or Nothing in VB) if the archive has
not been saved, and there are fewer than 65334 ZipEntry items
contained in the archive.
The Value is true if any of the following four conditions holds:
the uncompressed size of any entry is larger than 0xFFFFFFFF; the
compressed size of any entry is larger than 0xFFFFFFFF; the relative
offset of any entry within the zip archive is larger than 0xFFFFFFFF; or
there are more than 65534 entries in the archive. (0xFFFFFFFF =
4,294,967,295). The result may not be known until a Save() is attempted
on the zip archive. The Value of this
property may be set only AFTER one of the Save() methods has been called.
If none of the four conditions holds, and the archive has been saved, then
the Value is false.
A Value of false does not indicate that the zip archive, as saved,
does not use ZIP64. It merely indicates that ZIP64 is not required. An
archive may use ZIP64 even when not required if the property is set to , or if the property is set to and the output stream was not
seekable. Use the property to determine if
the most recent Save() method resulted in an archive that utilized
the ZIP64 extensions.
Indicates whether the most recent Save() operation used ZIP64 extensions.
The use of ZIP64 extensions within an archive is not always necessary, and
for interoperability concerns, it may be desired to NOT use ZIP64 if
possible. The property can be
set to use ZIP64 extensions only when necessary. In those cases,
Sometimes applications want to know whether a Save() actually used ZIP64
extensions. Applications can query this read-only property to learn
whether ZIP64 has been used in a just-saved ZipFile.
The value is null (or Nothing in VB) if the archive has not
been saved.
Non-null values (HasValue is true) indicate whether ZIP64
extensions were used during the most recent Save() operation. The
ZIP64 extensions may have been used as required by any particular entry
because of its uncompressed or compressed size, or because the archive is
larger than 4294967295 bytes, or because there are more than 65534 entries
in the archive, or because the UseZip64WhenSaving property was set
to , or because the
UseZip64WhenSaving property was set to and the output stream was not seekable.
The value of this property does not indicate the reason the ZIP64
extensions were used.
Indicates whether the most recent Read() operation read a zip file that uses
ZIP64 extensions.
This property will return null (Nothing in VB) if you've added an entry after reading
the zip file.
The text encoding to use when writing new entries to the ZipFile,
for those entries that cannot be encoded with the default (IBM437)
encoding; or, the text encoding that was used when reading the entries
from the ZipFile.
In its
zip specification, PKWare describes two options for encoding
filenames and comments: using IBM437 or UTF-8. But, some archiving tools
or libraries do not follow the specification, and instead encode
characters using the system default code page. For example, WinRAR when
run on a machine in Shanghai may encode filenames with the Big-5 Chinese
(950) code page. This behavior is contrary to the Zip specification, but
it occurs anyway.
When using DotNetZip to write zip archives that will be read by one of
these other archivers, set this property to specify the code page to use
when encoding the and for each ZipEntry in the zip file, for
values that cannot be encoded with the default codepage for zip files,
IBM437. This is why this property is "provisional". In all cases, IBM437
is used where possible, in other words, where no loss of data would
result. It is possible, therefore, to have a given entry with a
Comment encoded in IBM437 and a FileName encoded with the
specified "provisional" codepage.
Be aware that a zip file created after you've explicitly set the property to a value other than
IBM437 may not be compliant to the PKWare specification, and may not be
readable by compliant archivers. On the other hand, many (most?)
archivers are non-compliant and can read zip files created in arbitrary
code pages. The trick is to use or specify the proper codepage when
reading the zip.
When creating a zip archive using this library, it is possible to change
the value of between each
entry you add, and between adding entries and the call to
Save(). Don't do this. It will likely result in a zipfile that is
not readable. For best interoperability, either leave alone, or specify it only once,
before adding any entries to the ZipFile instance. There is one
exception to this recommendation, described later.
When using an arbitrary, non-UTF8 code page for encoding, there is no
standard way for the creator application - whether DotNetZip, WinZip,
WinRar, or something else - to formally specify in the zip file which
codepage has been used for the entries. As a result, readers of zip files
are not able to inspect the zip file and determine the codepage that was
used for the entries contained within it. It is left to the application
or user to determine the necessary codepage when reading zip files encoded
this way. In other words, if you explicitly specify the codepage when you
create the zipfile, you must explicitly specify the same codepage when
reading the zipfile.
The way you specify the code page to use when reading a zip file varies
depending on the tool or library you use to read the zip. In DotNetZip,
you use a ZipFile.Read() method that accepts an encoding parameter. It
isn't possible with Windows Explorer, as far as I know, to specify an
explicit codepage to use when reading a zip. If you use an incorrect
codepage when reading a zipfile, you will get entries with filenames that
are incorrect, and the incorrect filenames may even contain characters
that are not legal for use within filenames in Windows. Extracting entries
with illegal characters in the filenames will lead to exceptions. It's too
bad, but this is just the way things are with code pages in zip
files. Caveat Emptor.
Example: Suppose you create a zipfile that contains entries with
filenames that have Danish characters. If you use equal to "iso-8859-1" (cp 28591),
the filenames will be correctly encoded in the zip. But, to read that
zipfile correctly, you have to specify the same codepage at the time you
read it. If try to read that zip file with Windows Explorer or another
application that is not flexible with respect to the codepage used to
decode filenames in zipfiles, you will get a filename like "Inf�.txt".
When using DotNetZip to read a zip archive, and the zip archive uses an
arbitrary code page, you must specify the encoding to use before or when
the Zipfile is READ. This means you must use a ZipFile.Read()
method that allows you to specify a System.Text.Encoding parameter. Setting
the ProvisionalAlternateEncoding property after your application has read in
the zip archive will not affect the entry names of entries that have already
been read in.
And now, the exception to the rule described above. One strategy for
specifying the code page for a given zip file is to describe the code page
in a human-readable form in the Zip comment. For example, the comment may
read "Entries in this archive are encoded in the Big5 code page". For
maximum interoperability, the zip comment in this case should be encoded
in the default, IBM437 code page. In this case, the zip comment is
encoded using a different page than the filenames. To do this, Specify
ProvisionalAlternateEncoding to your desired region-specific code
page, once before adding any entries, and then reset
ProvisionalAlternateEncoding to IBM437 before setting the property and calling Save().
This example shows how to read a zip file using the Big-5 Chinese code page
(950), and extract each entry in the zip file. For this code to work as
desired, the Zipfile must have been created using the big5 code page
(CP950). This is typical, for example, when using WinRar on a machine with
CP950 set as the default code page. In that case, the names of entries
within the Zip archive will be stored in that code page, and reading the zip
archive must be done using that code page. If the application did not use
the correct code page in ZipFile.Read(), then names of entries within the
zip archive would not be correctly retrieved.
using (var zip = ZipFile.Read(zipFileName, System.Text.Encoding.GetEncoding("big5")))
{
// retrieve and extract an entry using a name encoded with CP950
zip[MyDesiredEntry].Extract("unpack");
}
Using zip As ZipFile = ZipFile.Read(ZipToExtract, System.Text.Encoding.GetEncoding("big5"))
' retrieve and extract an entry using a name encoded with CP950
zip(MyDesiredEntry).Extract("unpack")
End Using
DefaultEncoding
A Text Encoding to use when encoding the filenames and comments for
all the ZipEntry items, during a ZipFile.Save() operation.
Whether the encoding specified here is used during the save depends
on .
A flag that tells if and when this instance should apply
AlternateEncoding to encode the filenames and comments associated to
of ZipEntry objects contained within this instance.
The default text encoding used in zip archives. It is numeric 437, also
known as IBM437.
Gets or sets the TextWriter to which status messages are delivered
for the instance.
If the TextWriter is set to a non-null value, then verbose output is sent
to the TextWriter during Add, Read, Save and
Extract operations. Typically, console applications might use
Console.Out and graphical or headless applications might use a
System.IO.StringWriter. The output of this is suitable for viewing
by humans.
In this example, a console application instantiates a ZipFile, then
sets the StatusMessageTextWriter to Console.Out. At that
point, all verbose status messages for that ZipFile are sent to the
console.
using (ZipFile zip= ZipFile.Read(FilePath))
{
zip.StatusMessageTextWriter= System.Console.Out;
// messages are sent to the console during extraction
zip.ExtractAll();
}
Using zip As ZipFile = ZipFile.Read(FilePath)
zip.StatusMessageTextWriter= System.Console.Out
'Status Messages will be sent to the console during extraction
zip.ExtractAll()
End Using
In this example, a Windows Forms application instantiates a
ZipFile, then sets the StatusMessageTextWriter to a
StringWriter. At that point, all verbose status messages for that
ZipFile are sent to the StringWriter.
var sw = new System.IO.StringWriter();
using (ZipFile zip= ZipFile.Read(FilePath))
{
zip.StatusMessageTextWriter= sw;
zip.ExtractAll();
}
Console.WriteLine("{0}", sw.ToString());
Dim sw as New System.IO.StringWriter
Using zip As ZipFile = ZipFile.Read(FilePath)
zip.StatusMessageTextWriter= sw
zip.ExtractAll()
End Using
'Status Messages are now available in sw
Gets or sets the name for the folder to store the temporary file
this library writes when saving a zip archive.
This library will create a temporary file when saving a Zip archive to a
file. This file is written when calling one of the Save() methods
that does not save to a stream, or one of the SaveSelfExtractor()
methods.
By default, the library will create the temporary file in the directory
specified for the file itself, via the property or via
the method.
Setting this property allows applications to override this default
behavior, so that the library will create the temporary file in the
specified folder. For example, to have the library create the temporary
file in the current working directory, regardless where the ZipFile
is saved, specfy ".". To revert to the default behavior, set this
property to null (Nothing in VB).
When setting the property to a non-null value, the folder specified must
exist; if it does not an exception is thrown. The application should have
write and delete permissions on the folder. The permissions are not
explicitly checked ahead of time; if the application does not have the
appropriate rights, an exception will be thrown at the time Save()
is called.
There is no temporary file created when reading a zip archive. When
saving to a Stream, there is no temporary file created. For example, if
the application is an ASP.NET application and calls Save()
specifying the Response.OutputStream as the output stream, there is
no temporary file created.
Thrown when setting the property if the directory does not exist.
Sets the password to be used on the ZipFile instance.
When writing a zip archive, this password is applied to the entries, not
to the zip archive itself. It applies to any ZipEntry subsequently
added to the ZipFile, using one of the AddFile,
AddDirectory, AddEntry, or AddItem methods, etc.
When reading a zip archive, this property applies to any entry
subsequently extracted from the ZipFile using one of the Extract
methods on the ZipFile class.
When writing a zip archive, keep this in mind: though the password is set
on the ZipFile object, according to the Zip spec, the "directory" of the
archive - in other words the list of entries or files contained in the archive - is
not encrypted with the password, or protected in any way. If you set the
Password property, the password actually applies to individual entries
that are added to the archive, subsequent to the setting of this property.
The list of filenames in the archive that is eventually created will
appear in clear text, but the contents of the individual files are
encrypted. This is how Zip encryption works.
One simple way around this limitation is to simply double-wrap sensitive
filenames: Store the files in a zip file, and then store that zip file
within a second, "outer" zip file. If you apply a password to the outer
zip file, then readers will be able to see that the outer zip file
contains an inner zip file. But readers will not be able to read the
directory or file list of the inner zip file.
If you set the password on the ZipFile, and then add a set of files
to the archive, then each entry is encrypted with that password. You may
also want to change the password between adding different entries. If you
set the password, add an entry, then set the password to null
(Nothing in VB), and add another entry, the first entry is
encrypted and the second is not. If you call AddFile(), then set
the Password property, then call ZipFile.Save, the file
added will not be password-protected, and no warning will be generated.
When setting the Password, you may also want to explicitly set the property, to specify how to encrypt the entries added
to the ZipFile. If you set the Password to a non-null value and do not
set , then PKZip 2.0 ("Weak") encryption is used.
This encryption is relatively weak but is very interoperable. If you set
the password to a null value (Nothing in VB), Encryption is
reset to None.
All of the preceding applies to writing zip archives, in other words when
you use one of the Save methods. To use this property when reading or an
existing ZipFile, do the following: set the Password property on the
ZipFile, then call one of the Extract() overloads on the . In this case, the entry is extracted using the
Password that is specified on the ZipFile instance. If you
have not set the Password property, then the password is
null, and the entry is extracted with no password.
If you set the Password property on the ZipFile, then call
Extract() an entry that has not been encrypted with a password, the
password is not used for that entry, and the ZipEntry is extracted
as normal. In other words, the password is used only if necessary.
The class also has a Password property. It takes precedence
over this property on the ZipFile. Typically, you would use the
per-entry Password when most entries in the zip archive use one password,
and a few entries use a different password. If all entries in the zip
file use the same password, then it is simpler to just set this property
on the ZipFile itself, whether creating a zip archive or extracting
a zip archive.
This example creates a zip file, using password protection for the
entries, and then extracts the entries from the zip file. When creating
the zip file, the Readme.txt file is not protected with a password, but
the other two are password-protected as they are saved. During extraction,
each file is extracted with the appropriate password.
// create a file with encryption
using (ZipFile zip = new ZipFile())
{
zip.AddFile("ReadMe.txt");
zip.Password= "!Secret1";
zip.AddFile("MapToTheSite-7440-N49th.png");
zip.AddFile("2008-Regional-Sales-Report.pdf");
zip.Save("EncryptedArchive.zip");
}
// extract entries that use encryption
using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
{
zip.Password= "!Secret1";
zip.ExtractAll("extractDir");
}
Using zip As New ZipFile
zip.AddFile("ReadMe.txt")
zip.Password = "123456!"
zip.AddFile("MapToTheSite-7440-N49th.png")
zip.Password= "!Secret1";
zip.AddFile("2008-Regional-Sales-Report.pdf")
zip.Save("EncryptedArchive.zip")
End Using
' extract entries that use encryption
Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
zip.Password= "!Secret1"
zip.ExtractAll("extractDir")
End Using
ZipFile.Encryption
ZipEntry.Password
The action the library should take when extracting a file that already
exists.
This property affects the behavior of the Extract methods (one of the
Extract() or ExtractWithPassword() overloads), when
extraction would would overwrite an existing filesystem file. If you do
not set this property, the library throws an exception when extracting an
entry would overwrite an existing file.
This property has no effect when extracting to a stream, or when the file
to be extracted does not already exist.
The action the library should take when an error is encountered while
opening or reading files as they are saved into a zip archive.
Errors can occur as a file is being saved to the zip archive. For
example, the File.Open may fail, or a File.Read may fail, because of
lock conflicts or other reasons.
The first problem might occur after having called AddDirectory() on a
directory that contains a Clipper .dbf file; the file is locked by
Clipper and cannot be opened for read by another process. An example of
the second problem might occur when trying to zip a .pst file that is in
use by Microsoft Outlook. Outlook locks a range on the file, which allows
other processes to open the file, but not read it in its entirety.
This property tells DotNetZip what you would like to do in the case of
these errors. The primary options are: ZipErrorAction.Throw to
throw an exception (this is the default behavior if you don't set this
property); ZipErrorAction.Skip to Skip the file for which there
was an error and continue saving; ZipErrorAction.Retry to Retry
the entry that caused the problem; or
ZipErrorAction.InvokeErrorEvent to invoke an event handler.
This property is implicitly set to ZipErrorAction.InvokeErrorEvent
if you add a handler to the event. If you set
this property to something other than
ZipErrorAction.InvokeErrorEvent, then the ZipError
event is implicitly cleared. What it means is you can set one or the
other (or neither), depending on what you want, but you never need to set
both.
As with some other properties on the ZipFile class, like , , and , setting this property on a ZipFile
instance will cause the specified ZipErrorAction to be used on all
items that are subsequently added to the
ZipFile instance. If you set this property after you have added
items to the ZipFile, but before you have called Save(),
those items will not use the specified error handling action.
If you want to handle any errors that occur with any entry in the zip
file in the same way, then set this property once, before adding any
entries to the zip archive.
If you set this property to ZipErrorAction.Skip and you'd like to
learn which files may have been skipped after a Save(), you can
set the on the ZipFile before
calling Save(). A message will be emitted into that writer for
each skipped file, if any.
This example shows how to tell DotNetZip to skip any files for which an
error is generated during the Save().
Public Sub SaveZipFile()
Dim SourceFolder As String = "fodder"
Dim DestFile As String = "eHandler.zip"
Dim sw as New StringWriter
Using zipArchive As ZipFile = New ZipFile
' Tell DotNetZip to skip any files for which it encounters an error
zipArchive.ZipErrorAction = ZipErrorAction.Skip
zipArchive.StatusMessageTextWriter = sw
zipArchive.AddDirectory(SourceFolder)
zipArchive.Save(DestFile)
End Using
' examine sw here to see any messages
End Sub
The Encryption to use for entries added to the ZipFile.
Set this when creating a zip archive, or when updating a zip archive. The
specified Encryption is applied to the entries subsequently added to the
ZipFile instance. Applications do not need to set the
Encryption property when reading or extracting a zip archive.
If you set this to something other than EncryptionAlgorithm.None, you
will also need to set the .
As with some other properties on the ZipFile class, like and , setting this
property on a ZipFile instance will cause the specified
EncryptionAlgorithm to be used on all items
that are subsequently added to the ZipFile instance. In other
words, if you set this property after you have added items to the
ZipFile, but before you have called Save(), those items will
not be encrypted or protected with a password in the resulting zip
archive. To get a zip archive with encrypted entries, set this property,
along with the property, before calling
AddFile, AddItem, or AddDirectory (etc.) on the
ZipFile instance.
If you read a ZipFile, you can modify the Encryption on an
encrypted entry, only by setting the Encryption property on the
ZipEntry itself. Setting the Encryption property on the
ZipFile, once it has been created via a call to
ZipFile.Read(), does not affect entries that were previously read.
For example, suppose you read a ZipFile, and there is an encrypted
entry. Setting the Encryption property on that ZipFile and
then calling Save() on the ZipFile does not update the
Encryption used for the entries in the archive. Neither is an
exception thrown. Instead, what happens during the Save() is that
all previously existing entries are copied through to the new zip archive,
with whatever encryption and password that was used when originally
creating the zip archive. Upon re-reading that archive, to extract
entries, applications should use the original password or passwords, if
any.
Suppose an application reads a ZipFile, and there is an encrypted
entry. Setting the Encryption property on that ZipFile and
then adding new entries (via AddFile(), AddEntry(), etc)
and then calling Save() on the ZipFile does not update the
Encryption on any of the entries that had previously been in the
ZipFile. The Encryption property applies only to the
newly-added entries.
This example creates a zip archive that uses encryption, and then extracts
entries from the archive. When creating the zip archive, the ReadMe.txt
file is zipped without using a password or encryption. The other files
use encryption.
// Create a zip archive with AES Encryption.
using (ZipFile zip = new ZipFile())
{
zip.AddFile("ReadMe.txt");
zip.Encryption= EncryptionAlgorithm.WinZipAes256;
zip.Password= "Top.Secret.No.Peeking!";
zip.AddFile("7440-N49th.png");
zip.AddFile("2008-Regional-Sales-Report.pdf");
zip.Save("EncryptedArchive.zip");
}
// Extract a zip archive that uses AES Encryption.
// You do not need to specify the algorithm during extraction.
using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
{
zip.Password= "Top.Secret.No.Peeking!";
zip.ExtractAll("extractDirectory");
}
' Create a zip that uses Encryption.
Using zip As New ZipFile()
zip.Encryption= EncryptionAlgorithm.WinZipAes256
zip.Password= "Top.Secret.No.Peeking!"
zip.AddFile("ReadMe.txt")
zip.AddFile("7440-N49th.png")
zip.AddFile("2008-Regional-Sales-Report.pdf")
zip.Save("EncryptedArchive.zip")
End Using
' Extract a zip archive that uses AES Encryption.
' You do not need to specify the algorithm during extraction.
Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
zip.Password= "Top.Secret.No.Peeking!"
zip.ExtractAll("extractDirectory")
End Using
ZipFile.Password
ZipEntry.Encryption
A callback that allows the application to specify the compression level
to use for entries subsequently added to the zip archive.
With this callback, the DotNetZip library allows the application to
determine whether compression will be used, at the time of the
Save. This may be useful if the application wants to favor
speed over size, and wants to defer the decision until the time of
Save.
Typically applications set the property on
the ZipFile or on each ZipEntry to determine the level of
compression used. This is done at the time the entry is added to the
ZipFile. Setting the property to
Ionic.Zlib.CompressionLevel.None means no compression will be used.
This callback allows the application to defer the decision on the
CompressionLevel to use, until the time of the call to
ZipFile.Save(). The callback is invoked once per ZipEntry,
at the time the data for the entry is being written out as part of a
Save() operation. The application can use whatever criteria it
likes in determining the level to return. For example, an application may
wish that no .mp3 files should be compressed, because they are already
compressed and the extra compression is not worth the CPU time incurred,
and so can return None for all .mp3 entries.
The library determines whether compression will be attempted for an entry
this way: If the entry is a zero length file, or a directory, no
compression is used. Otherwise, if this callback is set, it is invoked
and the CompressionLevel is set to the return value. If this
callback has not been set, then the previously set value for
CompressionLevel is used.
The maximum size of an output segment, when saving a split Zip file.
Set this to a non-zero value before calling or to specify that the ZipFile should be saved as a
split archive, also sometimes called a spanned archive. Some also
call them multi-file archives.
A split zip archive is saved in a set of discrete filesystem files,
rather than in a single file. This is handy when transmitting the
archive in email or some other mechanism that has a limit to the size of
each file. The first file in a split archive will be named
basename.z01, the second will be named basename.z02, and
so on. The final file is named basename.zip. According to the zip
specification from PKWare, the minimum value is 65536, for a 64k segment
size. The maximum number of segments allows in a split archive is 99.
The value of this property determines the maximum size of a split
segment when writing a split archive. For example, suppose you have a
ZipFile that would save to a single file of 200k. If you set the
MaxOutputSegmentSize to 65536 before calling Save(), you
will get four distinct output files. On the other hand if you set this
property to 256k, then you will get a single-file archive for that
ZipFile.
The size of each split output file will be as large as possible, up to
the maximum size set here. The zip specification requires that some data
fields in a zip archive may not span a split boundary, and an output
segment may be smaller than the maximum if necessary to avoid that
problem. Also, obviously the final segment of the archive may be smaller
than the maximum segment size. Segments will never be larger than the
value set with this property.
You can save a split Zip file only when saving to a regular filesystem
file. It's not possible to save a split zip file as a self-extracting
archive, nor is it possible to save a split zip file to a stream. When
saving to a SFX or to a Stream, this property is ignored.
About interoperability: Split or spanned zip files produced by DotNetZip
can be read by WinZip or PKZip, and vice-versa. Segmented zip files may
not be readable by other tools, if those other tools don't support zip
spanning or splitting. When in doubt, test. I don't believe Windows
Explorer can extract a split archive.
This property has no effect when reading a split archive. You can read
a split archive in the normal way with DotNetZip.
When saving a zip file, if you want a regular zip file rather than a
split zip file, don't set this property, or set it to Zero.
If you read a split archive, with and
then subsequently call ZipFile.Save(), unless you set this
property before calling Save(), you will get a normal,
single-file archive.
Returns the number of segments used in the most recent Save() operation.
This is normally zero, unless you have set the property. If you have set , and then you save a file, after the call to
Save() completes, you can read this value to learn the number of segments that
were created.
If you call Save("Archive.zip"), and it creates 5 segments, then you
will have filesystem files named Archive.z01, Archive.z02, Archive.z03,
Archive.z04, and Archive.zip, and the value of this property will be 5.
The size threshold for an entry, above which a parallel deflate is used.
DotNetZip will use multiple threads to compress any ZipEntry,
if the entry is larger than the given size. Zero means "always
use parallel deflate", while -1 means "never use parallel
deflate". The default value for this property is 512k. Aside
from the special values of 0 and 1, the minimum value is 65536.
If the entry size cannot be known before compression, as with a
read-forward stream, then Parallel deflate will never be
performed, unless the value of this property is zero.
A parallel deflate operations will speed up the compression of
large files, on computers with multiple CPUs or multiple CPU
cores. For files above 1mb, on a dual core or dual-cpu (2p)
machine, the time required to compress the file can be 70% of the
single-threaded deflate. For very large files on 4p machines the
compression can be done in 30% of the normal time. The downside
is that parallel deflate consumes extra memory during the deflate,
and the deflation is not as effective.
Parallel deflate tends to yield slightly less compression when
compared to as single-threaded deflate; this is because the original
data stream is split into multiple independent buffers, each of which
is compressed in parallel. But because they are treated
independently, there is no opportunity to share compression
dictionaries. For that reason, a deflated stream may be slightly
larger when compressed using parallel deflate, as compared to a
traditional single-threaded deflate. Sometimes the increase over the
normal deflate is as much as 5% of the total compressed size. For
larger files it can be as small as 0.1%.
Multi-threaded compression does not give as much an advantage when
using Encryption. This is primarily because encryption tends to slow
down the entire pipeline. Also, multi-threaded compression gives less
of an advantage when using lower compression levels, for example . You may have to
perform some tests to determine the best approach for your situation.
The maximum number of buffer pairs to use when performing
parallel compression.
This property sets an upper limit on the number of memory
buffer pairs to create when performing parallel
compression. The implementation of the parallel
compression stream allocates multiple buffers to
facilitate parallel compression. As each buffer fills up,
the stream uses
ThreadPool.QueueUserWorkItem() to compress those
buffers in a background threadpool thread. After a buffer
is compressed, it is re-ordered and written to the output
stream.
A higher number of buffer pairs enables a higher degree of
parallelism, which tends to increase the speed of compression on
multi-cpu computers. On the other hand, a higher number of buffer
pairs also implies a larger memory consumption, more active worker
threads, and a higher cpu utilization for any compression. This
property enables the application to limit its memory consumption and
CPU utilization behavior depending on requirements.
For each compression "task" that occurs in parallel, there are 2
buffers allocated: one for input and one for output. This property
sets a limit for the number of pairs. The total amount of storage
space allocated for buffering will then be (N*S*2), where N is the
number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer
pairs per CPU core, so if your machine has 4 cores, and you retain
the default buffer size of 128k, then the
ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
memory in total, or 4mb, in blocks of 128kb. If you then set this
property to 8, then the number will be 8 * 2 * 128kb of buffer
memory, or 2mb.
CPU utilization will also go up with additional buffers, because a
larger number of buffer pairs allows a larger number of background
threads to compress in parallel. If you find that parallel
compression is consuming too much memory or CPU, you can adjust this
value downward.
The default value is 16. Different values may deliver better or
worse results, depending on your priorities and the dynamic
performance characteristics of your storage and compute resources.
This property is not the number of buffer pairs to use; it is an
upper limit. An illustration: Suppose you have an application that
uses the default value of this property (which is 16), and it runs
on a machine with 2 CPU cores. In that case, DotNetZip will allocate
4 buffer pairs per CPU core, for a total of 8 pairs. The upper
limit specified by this property has no effect.
The application can set this value at any time
before calling ZipFile.Save().
Provides a string representation of the instance.
a string representation of the instance.
Returns the version number on the DotNetZip assembly.
This property is exposed as a convenience. Callers could also get the
version value by retrieving GetName().Version on the
System.Reflection.Assembly object pointing to the DotNetZip
assembly. But sometimes it is not clear which assembly is being loaded.
This property makes it clear.
This static property is primarily useful for diagnostic purposes.
Creates a new ZipFile instance, using the specified filename.
Applications can use this constructor to create a new ZipFile for writing,
or to slurp in an existing zip archive for read and update purposes.
To create a new zip archive, an application can call this constructor,
passing the name of a file that does not exist. The name may be a fully
qualified path. Then the application can add directories or files to the
ZipFile via AddDirectory(), AddFile(), AddItem()
and then write the zip archive to the disk by calling Save(). The
zip file is not actually opened and written to the disk until the
application calls ZipFile.Save(). At that point the new zip file
with the given name is created.
If you won't know the name of the Zipfile until the time you call
ZipFile.Save(), or if you plan to save to a stream (which has no
name), then you should use the no-argument constructor.
The application can also call this constructor to read an existing zip
archive. passing the name of a valid zip file that does exist. But, it's
better form to use the static method,
passing the name of the zip file, because using ZipFile.Read() in
your code communicates very clearly what you are doing. In either case,
the file is then read into the ZipFile instance. The app can then
enumerate the entries or can modify the zip file, for example adding
entries, removing entries, changing comments, and so on.
One advantage to this parameterized constructor: it allows applications to
use the same code to add items to a zip archive, regardless of whether the
zip file exists.
Instances of the ZipFile class are not multi-thread safe. You may
not party on a single instance with multiple threads. You may have
multiple threads that each use a distinct ZipFile instance, or you
can synchronize multi-thread access to a single instance.
By the way, since DotNetZip is so easy to use, don't you think you should
donate $5 or $10?
Thrown if name refers to an existing file that is not a valid zip file.
This example shows how to create a zipfile, and add a few files into it.
String ZipFileToCreate = "archive1.zip";
String DirectoryToZip = "c:\\reports";
using (ZipFile zip = new ZipFile())
{
// Store all files found in the top level directory, into the zip archive.
String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
zip.AddFiles(filenames, "files");
zip.Save(ZipFileToCreate);
}
Dim ZipFileToCreate As String = "archive1.zip"
Dim DirectoryToZip As String = "c:\reports"
Using zip As ZipFile = New ZipFile()
Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
zip.AddFiles(filenames, "files")
zip.Save(ZipFileToCreate)
End Using
The filename to use for the new zip archive.
Creates a new ZipFile instance, using the specified name for the
filename, and the specified Encoding.
See the documentation on the ZipFile
constructor that accepts a single string argument for basic
information on all the ZipFile constructors.
The Encoding is used as the default alternate encoding for entries with
filenames or comments that cannot be encoded with the IBM437 code page.
This is equivalent to setting the property on the ZipFile
instance after construction.
Instances of the ZipFile class are not multi-thread safe. You may
not party on a single instance with multiple threads. You may have
multiple threads that each use a distinct ZipFile instance, or you
can synchronize multi-thread access to a single instance.
Thrown if name refers to an existing file that is not a valid zip file.
The filename to use for the new zip archive.
The Encoding is used as the default alternate
encoding for entries with filenames or comments that cannot be encoded
with the IBM437 code page.
Create a zip file, without specifying a target filename or stream to save to.
See the documentation on the ZipFile
constructor that accepts a single string argument for basic
information on all the ZipFile constructors.
After instantiating with this constructor and adding entries to the
archive, the application should call or
to save to a file or a
stream, respectively. The application can also set the
property and then call the no-argument method. (This
is the preferred approach for applications that use the library through
COM interop.) If you call the no-argument method
without having set the Name of the ZipFile, either through
the parameterized constructor or through the explicit property , the
Save() will throw, because there is no place to save the file.
Instances of the ZipFile class are not multi-thread safe. You may
have multiple threads that each use a distinct ZipFile instance, or
you can synchronize multi-thread access to a single instance.
This example creates a Zip archive called Backup.zip, containing all the files
in the directory DirectoryToZip. Files within subdirectories are not zipped up.
using (ZipFile zip = new ZipFile())
{
// Store all files found in the top level directory, into the zip archive.
// note: this code does not recurse subdirectories!
String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
zip.AddFiles(filenames, "files");
zip.Save("Backup.zip");
}
Using zip As New ZipFile
' Store all files found in the top level directory, into the zip archive.
' note: this code does not recurse subdirectories!
Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
zip.AddFiles(filenames, "files")
zip.Save("Backup.zip")
End Using
Create a zip file, specifying a text Encoding, but without specifying a
target filename or stream to save to.
See the documentation on the ZipFile
constructor that accepts a single string argument for basic
information on all the ZipFile constructors.
The Encoding is used as the default alternate encoding for entries with
filenames or comments that cannot be encoded with the IBM437 code page.
Creates a new ZipFile instance, using the specified name for the
filename, and the specified status message writer.
See the documentation on the ZipFile
constructor that accepts a single string argument for basic
information on all the ZipFile constructors.
This version of the constructor allows the caller to pass in a TextWriter,
to which verbose messages will be written during extraction or creation of
the zip archive. A console application may wish to pass
System.Console.Out to get messages on the Console. A graphical or headless
application may wish to capture the messages in a different
TextWriter, for example, a StringWriter, and then display
the messages in a TextBox, or generate an audit log of ZipFile operations.
To encrypt the data for the files added to the ZipFile instance,
set the Password property after creating the ZipFile instance.
Instances of the ZipFile class are not multi-thread safe. You may
not party on a single instance with multiple threads. You may have
multiple threads that each use a distinct ZipFile instance, or you
can synchronize multi-thread access to a single instance.
Thrown if name refers to an existing file that is not a valid zip file.
using (ZipFile zip = new ZipFile("Backup.zip", Console.Out))
{
// Store all files found in the top level directory, into the zip archive.
// note: this code does not recurse subdirectories!
// Status messages will be written to Console.Out
String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
zip.AddFiles(filenames);
zip.Save();
}
Using zip As New ZipFile("Backup.zip", Console.Out)
' Store all files found in the top level directory, into the zip archive.
' note: this code does not recurse subdirectories!
' Status messages will be written to Console.Out
Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
zip.AddFiles(filenames)
zip.Save()
End Using
The filename to use for the new zip archive.
A TextWriter to use for writing
verbose status messages.
Creates a new ZipFile instance, using the specified name for the
filename, the specified status message writer, and the specified Encoding.
This constructor works like the ZipFile
constructor that accepts a single string argument. See that
reference for detail on what this constructor does.
This version of the constructor allows the caller to pass in a
TextWriter, and an Encoding. The TextWriter will collect
verbose messages that are generated by the library during extraction or
creation of the zip archive. A console application may wish to pass
System.Console.Out to get messages on the Console. A graphical or
headless application may wish to capture the messages in a different
TextWriter, for example, a StringWriter, and then display
the messages in a TextBox, or generate an audit log of
ZipFile operations.
The Encoding is used as the default alternate encoding for entries
with filenames or comments that cannot be encoded with the IBM437 code
page. This is a equivalent to setting the property on the ZipFile
instance after construction.
To encrypt the data for the files added to the ZipFile instance,
set the Password property after creating the ZipFile
instance.
Instances of the ZipFile class are not multi-thread safe. You may
not party on a single instance with multiple threads. You may have
multiple threads that each use a distinct ZipFile instance, or you
can synchronize multi-thread access to a single instance.
Thrown if fileName refers to an existing file that is not a valid zip file.
The filename to use for the new zip archive.
A TextWriter to use for writing verbose
status messages.
The Encoding is used as the default alternate encoding for entries with
filenames or comments that cannot be encoded with the IBM437 code page.
Initialize a ZipFile instance by reading in a zip file.
This method is primarily useful from COM Automation environments, when
reading or extracting zip files. In COM, it is not possible to invoke
parameterized constructors for a class. A COM Automation application can
update a zip file by using the default (no argument)
constructor, then calling Initialize() to read the contents
of an on-disk zip archive into the ZipFile instance.
.NET applications are encouraged to use the ZipFile.Read() methods
for better clarity.
the name of the existing zip file to read in.
This is an integer indexer into the Zip archive.
This property is read-only.
Internally, the ZipEntry instances that belong to the
ZipFile are stored in a Dictionary. When you use this
indexer the first time, it creates a read-only
List<ZipEntry> from the Dictionary.Values Collection.
If at any time you modify the set of entries in the ZipFile,
either by adding an entry, removing an entry, or renaming an
entry, a new List will be created, and the numeric indexes for the
remaining entries may be different.
This means you cannot rename any ZipEntry from
inside an enumeration of the zip file.
The index value.
The ZipEntry within the Zip archive at the specified index. If the
entry does not exist in the archive, this indexer throws.
This is a name-based indexer into the Zip archive.
This property is read-only.
The property on the ZipFile
determines whether retrieval via this indexer is done via case-sensitive
comparisons. By default, retrieval is not case sensitive. This makes
sense on Windows, in which filesystems are not case sensitive.
Regardless of case-sensitivity, it is not always the case that
this[value].FileName == value. In other words, the FileName
property of the ZipEntry retrieved with this indexer, may or may
not be equal to the index value.
This is because DotNetZip performs a normalization of filenames passed to
this indexer, before attempting to retrieve the item. That normalization
includes: removal of a volume letter and colon, swapping backward slashes
for forward slashes. So, zip["dir1\\entry1.txt"].FileName ==
"dir1/entry.txt".
Directory entries in the zip file may be retrieved via this indexer only
with names that have a trailing slash. DotNetZip automatically appends a
trailing slash to the names of any directory entries added to a zip.
This example extracts only the entries in a zip file that are .txt files.
using (ZipFile zip = ZipFile.Read("PackedDocuments.zip"))
{
foreach (string s1 in zip.EntryFilenames)
{
if (s1.EndsWith(".txt"))
zip[s1].Extract("textfiles");
}
}
Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip")
Dim s1 As String
For Each s1 In zip.EntryFilenames
If s1.EndsWith(".txt") Then
zip(s1).Extract("textfiles")
End If
Next
End Using
Thrown if the caller attempts to assign a non-null value to the indexer.
The name of the file, including any directory path, to retrieve from the
zip. The filename match is not case-sensitive by default; you can use the
property to change this behavior. The
pathname can use forward-slashes or backward slashes.
The ZipEntry within the Zip archive, given by the specified
filename. If the named entry does not exist in the archive, this indexer
returns null (Nothing in VB).
The list of filenames for the entries contained within the zip archive.
According to the ZIP specification, the names of the entries use forward
slashes in pathnames. If you are scanning through the list, you may have
to swap forward slashes for backslashes.
This example shows one way to test if a filename is already contained
within a zip archive.
String zipFileToRead= "PackedDocuments.zip";
string candidate = "DatedMaterial.xps";
using (ZipFile zip = new ZipFile(zipFileToRead))
{
if (zip.EntryFilenames.Contains(candidate))
Console.WriteLine("The file '{0}' exists in the zip archive '{1}'",
candidate,
zipFileName);
else
Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'",
candidate,
zipFileName);
Console.WriteLine();
}
Dim zipFileToRead As String = "PackedDocuments.zip"
Dim candidate As String = "DatedMaterial.xps"
Using zip As ZipFile.Read(ZipFileToRead)
If zip.EntryFilenames.Contains(candidate) Then
Console.WriteLine("The file '{0}' exists in the zip archive '{1}'", _
candidate, _
zipFileName)
Else
Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'", _
candidate, _
zipFileName)
End If
Console.WriteLine
End Using
The list of strings for the filenames contained within the Zip archive.
Returns the readonly collection of entries in the Zip archive.
If there are no entries in the current ZipFile, the value returned is a
non-null zero-element collection. If there are entries in the zip file,
the elements are returned in no particular order.
This is the implied enumerator on the ZipFile class. If you use a
ZipFile instance in a context that expects an enumerator, you will
get this collection.
Returns a readonly collection of entries in the Zip archive, sorted by FileName.
If there are no entries in the current ZipFile, the value returned
is a non-null zero-element collection. If there are entries in the zip
file, the elements are returned sorted by the name of the entry.
This example fills a Windows Forms ListView with the entries in a zip file.
using (ZipFile zip = ZipFile.Read(zipFile))
{
foreach (ZipEntry entry in zip.EntriesSorted)
{
ListViewItem item = new ListViewItem(n.ToString());
n++;
string[] subitems = new string[] {
entry.FileName.Replace("/","\\"),
entry.LastModified.ToString("yyyy-MM-dd HH:mm:ss"),
entry.UncompressedSize.ToString(),
String.Format("{0,5:F0}%", entry.CompressionRatio),
entry.CompressedSize.ToString(),
(entry.UsesEncryption) ? "Y" : "N",
String.Format("{0:X8}", entry.Crc)};
foreach (String s in subitems)
{
ListViewItem.ListViewSubItem subitem = new ListViewItem.ListViewSubItem();
subitem.Text = s;
item.SubItems.Add(subitem);
}
this.listView1.Items.Add(item);
}
}
Returns the number of entries in the Zip archive.
Removes the given ZipEntry from the zip archive.
After calling RemoveEntry, the application must call Save to
make the changes permanent.
Thrown if the specified ZipEntry does not exist in the ZipFile.
In this example, all entries in the zip archive dating from before
December 31st, 2007, are removed from the archive. This is actually much
easier if you use the RemoveSelectedEntries method. But I needed an
example for RemoveEntry, so here it is.
String ZipFileToRead = "ArchiveToModify.zip";
System.DateTime Threshold = new System.DateTime(2007,12,31);
using (ZipFile zip = ZipFile.Read(ZipFileToRead))
{
var EntriesToRemove = new System.Collections.Generic.List<ZipEntry>();
foreach (ZipEntry e in zip)
{
if (e.LastModified < Threshold)
{
// We cannot remove the entry from the list, within the context of
// an enumeration of said list.
// So we add the doomed entry to a list to be removed later.
EntriesToRemove.Add(e);
}
}
// actually remove the doomed entries.
foreach (ZipEntry zombie in EntriesToRemove)
zip.RemoveEntry(zombie);
zip.Comment= String.Format("This zip archive was updated at {0}.",
System.DateTime.Now.ToString("G"));
// save with a different name
zip.Save("Archive-Updated.zip");
}
Dim ZipFileToRead As String = "ArchiveToModify.zip"
Dim Threshold As New DateTime(2007, 12, 31)
Using zip As ZipFile = ZipFile.Read(ZipFileToRead)
Dim EntriesToRemove As New System.Collections.Generic.List(Of ZipEntry)
Dim e As ZipEntry
For Each e In zip
If (e.LastModified < Threshold) Then
' We cannot remove the entry from the list, within the context of
' an enumeration of said list.
' So we add the doomed entry to a list to be removed later.
EntriesToRemove.Add(e)
End If
Next
' actually remove the doomed entries.
Dim zombie As ZipEntry
For Each zombie In EntriesToRemove
zip.RemoveEntry(zombie)
Next
zip.Comment = String.Format("This zip archive was updated at {0}.", DateTime.Now.ToString("G"))
'save as a different name
zip.Save("Archive-Updated.zip")
End Using
The ZipEntry to remove from the zip.
Removes the ZipEntry with the given filename from the zip archive.
After calling RemoveEntry, the application must call Save to
make the changes permanent.
Thrown if the ZipFile is not updatable.
Thrown if a ZipEntry with the specified filename does not exist in
the ZipFile.
This example shows one way to remove an entry with a given filename from
an existing zip archive.
String zipFileToRead= "PackedDocuments.zip";
string candidate = "DatedMaterial.xps";
using (ZipFile zip = ZipFile.Read(zipFileToRead))
{
if (zip.EntryFilenames.Contains(candidate))
{
zip.RemoveEntry(candidate);
zip.Comment= String.Format("The file '{0}' has been removed from this archive.",
Candidate);
zip.Save();
}
}
Dim zipFileToRead As String = "PackedDocuments.zip"
Dim candidate As String = "DatedMaterial.xps"
Using zip As ZipFile = ZipFile.Read(zipFileToRead)
If zip.EntryFilenames.Contains(candidate) Then
zip.RemoveEntry(candidate)
zip.Comment = String.Format("The file '{0}' has been removed from this archive.", Candidate)
zip.Save
End If
End Using
The name of the file, including any directory path, to remove from the zip.
The filename match is not case-sensitive by default; you can use the
CaseSensitiveRetrieval property to change this behavior. The
pathname can use forward-slashes or backward slashes.
Closes the read and write streams associated
to the ZipFile, if necessary.
The Dispose() method is generally employed implicitly, via a using(..) {..}
statement. (Using...End Using in VB) If you do not employ a using
statement, insure that your application calls Dispose() explicitly. For
example, in a Powershell application, or an application that uses the COM
interop interface, you must call Dispose() explicitly.
This example extracts an entry selected by name, from the Zip file to the
Console.
using (ZipFile zip = ZipFile.Read(zipfile))
{
foreach (ZipEntry e in zip)
{
if (WantThisEntry(e.FileName))
zip.Extract(e.FileName, Console.OpenStandardOutput());
}
} // Dispose() is called implicitly here.
Using zip As ZipFile = ZipFile.Read(zipfile)
Dim e As ZipEntry
For Each e In zip
If WantThisEntry(e.FileName) Then
zip.Extract(e.FileName, Console.OpenStandardOutput())
End If
Next
End Using ' Dispose is implicity called here
Disposes any managed resources, if the flag is set, then marks the
instance disposed. This method is typically not called explicitly from
application code.
Applications should call the no-arg Dispose method.
indicates whether the method should dispose streams or not.
Default size of the buffer used for IO.
An event handler invoked when a Save() starts, before and after each
entry has been written to the archive, when a Save() completes, and
during other Save events.
Depending on the particular event, different properties on the parameter are set. The following
table summarizes the available EventTypes and the conditions under
which this event handler is invoked with a
SaveProgressEventArgs with the given EventType.
value of EntryType
Meaning and conditions
-
ZipProgressEventType.Saving_Started
Fired when ZipFile.Save() begins.
-
ZipProgressEventType.Saving_BeforeSaveEntry
Fired within ZipFile.Save(), just before writing data for each
particular entry.
-
ZipProgressEventType.Saving_AfterSaveEntry
Fired within ZipFile.Save(), just after having finished writing data
for each particular entry.
-
ZipProgressEventType.Saving_Completed
Fired when ZipFile.Save() has completed.
-
ZipProgressEventType.Saving_AfterSaveTempArchive
Fired after the temporary file has been created. This happens only
when saving to a disk file. This event will not be invoked when
saving to a stream.
-
ZipProgressEventType.Saving_BeforeRenameTempArchive
Fired just before renaming the temporary file to the permanent
location. This happens only when saving to a disk file. This event
will not be invoked when saving to a stream.
-
ZipProgressEventType.Saving_AfterRenameTempArchive
Fired just after renaming the temporary file to the permanent
location. This happens only when saving to a disk file. This event
will not be invoked when saving to a stream.
-
ZipProgressEventType.Saving_AfterCompileSelfExtractor
Fired after a self-extracting archive has finished compiling. This
EventType is used only within SaveSelfExtractor().
-
ZipProgressEventType.Saving_BytesRead
Set during the save of a particular entry, to update progress of the
Save(). When this EventType is set, the BytesTransferred is the
number of bytes that have been read from the source stream. The
TotalBytesToTransfer is the number of bytes in the uncompressed
file.
This example uses an anonymous method to handle the
SaveProgress event, by updating a progress bar.
progressBar1.Value = 0;
progressBar1.Max = listbox1.Items.Count;
using (ZipFile zip = new ZipFile())
{
// listbox1 contains a list of filenames
zip.AddFiles(listbox1.Items);
// do the progress bar:
zip.SaveProgress += (sender, e) => {
if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry) {
progressBar1.PerformStep();
}
};
zip.Save(fs);
}
This example uses a named method as the
SaveProgress event handler, to update the user, in a
console-based application.
static bool justHadByteUpdate= false;
public static void SaveProgress(object sender, SaveProgressEventArgs e)
{
if (e.EventType == ZipProgressEventType.Saving_Started)
Console.WriteLine("Saving: {0}", e.ArchiveName);
else if (e.EventType == ZipProgressEventType.Saving_Completed)
{
justHadByteUpdate= false;
Console.WriteLine();
Console.WriteLine("Done: {0}", e.ArchiveName);
}
else if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry)
{
if (justHadByteUpdate)
Console.WriteLine();
Console.WriteLine(" Writing: {0} ({1}/{2})",
e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal);
justHadByteUpdate= false;
}
else if (e.EventType == ZipProgressEventType.Saving_EntryBytesRead)
{
if (justHadByteUpdate)
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer,
e.BytesTransferred / (0.01 * e.TotalBytesToTransfer ));
justHadByteUpdate= true;
}
}
public static ZipUp(string targetZip, string directory)
{
using (var zip = new ZipFile()) {
zip.SaveProgress += SaveProgress;
zip.AddDirectory(directory);
zip.Save(targetZip);
}
}
Public Sub ZipUp(ByVal targetZip As String, ByVal directory As String)
Using zip As ZipFile = New ZipFile
AddHandler zip.SaveProgress, AddressOf MySaveProgress
zip.AddDirectory(directory)
zip.Save(targetZip)
End Using
End Sub
Private Shared justHadByteUpdate As Boolean = False
Public Shared Sub MySaveProgress(ByVal sender As Object, ByVal e As SaveProgressEventArgs)
If (e.EventType Is ZipProgressEventType.Saving_Started) Then
Console.WriteLine("Saving: {0}", e.ArchiveName)
ElseIf (e.EventType Is ZipProgressEventType.Saving_Completed) Then
justHadByteUpdate = False
Console.WriteLine
Console.WriteLine("Done: {0}", e.ArchiveName)
ElseIf (e.EventType Is ZipProgressEventType.Saving_BeforeWriteEntry) Then
If justHadByteUpdate Then
Console.WriteLine
End If
Console.WriteLine(" Writing: {0} ({1}/{2})", e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal)
justHadByteUpdate = False
ElseIf (e.EventType Is ZipProgressEventType.Saving_EntryBytesRead) Then
If justHadByteUpdate Then
Console.SetCursorPosition(0, Console.CursorTop)
End If
Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, _
e.TotalBytesToTransfer, _
(CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer)))
justHadByteUpdate = True
End If
End Sub
This is a more complete example of using the SaveProgress
events in a Windows Forms application, with a
Thread object.
delegate void SaveEntryProgress(SaveProgressEventArgs e);
delegate void ButtonClick(object sender, EventArgs e);
internal class WorkerOptions
{
public string ZipName;
public string Folder;
public string Encoding;
public string Comment;
public int ZipFlavor;
public Zip64Option Zip64;
}
private int _progress2MaxFactor;
private bool _saveCanceled;
private long _totalBytesBeforeCompress;
private long _totalBytesAfterCompress;
private Thread _workerThread;
private void btnZipup_Click(object sender, EventArgs e)
{
KickoffZipup();
}
private void btnCancel_Click(object sender, EventArgs e)
{
if (this.lblStatus.InvokeRequired)
{
this.lblStatus.Invoke(new ButtonClick(this.btnCancel_Click), new object[] { sender, e });
}
else
{
_saveCanceled = true;
lblStatus.Text = "Canceled...";
ResetState();
}
}
private void KickoffZipup()
{
_folderName = tbDirName.Text;
if (_folderName == null || _folderName == "") return;
if (this.tbZipName.Text == null || this.tbZipName.Text == "") return;
// check for existence of the zip file:
if (System.IO.File.Exists(this.tbZipName.Text))
{
var dlgResult = MessageBox.Show(String.Format("The file you have specified ({0}) already exists." +
" Do you want to overwrite this file?", this.tbZipName.Text),
"Confirmation is Required", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dlgResult != DialogResult.Yes) return;
System.IO.File.Delete(this.tbZipName.Text);
}
_saveCanceled = false;
_nFilesCompleted = 0;
_totalBytesAfterCompress = 0;
_totalBytesBeforeCompress = 0;
this.btnOk.Enabled = false;
this.btnOk.Text = "Zipping...";
this.btnCancel.Enabled = true;
lblStatus.Text = "Zipping...";
var options = new WorkerOptions
{
ZipName = this.tbZipName.Text,
Folder = _folderName,
Encoding = "ibm437"
};
if (this.comboBox1.SelectedIndex != 0)
{
options.Encoding = this.comboBox1.SelectedItem.ToString();
}
if (this.radioFlavorSfxCmd.Checked)
options.ZipFlavor = 2;
else if (this.radioFlavorSfxGui.Checked)
options.ZipFlavor = 1;
else options.ZipFlavor = 0;
if (this.radioZip64AsNecessary.Checked)
options.Zip64 = Zip64Option.AsNecessary;
else if (this.radioZip64Always.Checked)
options.Zip64 = Zip64Option.Always;
else options.Zip64 = Zip64Option.Never;
options.Comment = String.Format("Encoding:{0} || Flavor:{1} || ZIP64:{2}\r\nCreated at {3} || {4}\r\n",
options.Encoding,
FlavorToString(options.ZipFlavor),
options.Zip64.ToString(),
System.DateTime.Now.ToString("yyyy-MMM-dd HH:mm:ss"),
this.Text);
if (this.tbComment.Text != TB_COMMENT_NOTE)
options.Comment += this.tbComment.Text;
_workerThread = new Thread(this.DoSave);
_workerThread.Name = "Zip Saver thread";
_workerThread.Start(options);
this.Cursor = Cursors.WaitCursor;
}
private void DoSave(Object p)
{
WorkerOptions options = p as WorkerOptions;
try
{
using (var zip1 = new ZipFile())
{
zip1.ProvisionalAlternateEncoding = System.Text.Encoding.GetEncoding(options.Encoding);
zip1.Comment = options.Comment;
zip1.AddDirectory(options.Folder);
_entriesToZip = zip1.EntryFileNames.Count;
SetProgressBars();
zip1.SaveProgress += this.zip1_SaveProgress;
zip1.UseZip64WhenSaving = options.Zip64;
if (options.ZipFlavor == 1)
zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.WinFormsApplication);
else if (options.ZipFlavor == 2)
zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.ConsoleApplication);
else
zip1.Save(options.ZipName);
}
}
catch (System.Exception exc1)
{
MessageBox.Show(String.Format("Exception while zipping: {0}", exc1.Message));
btnCancel_Click(null, null);
}
}
void zip1_SaveProgress(object sender, SaveProgressEventArgs e)
{
switch (e.EventType)
{
case ZipProgressEventType.Saving_AfterWriteEntry:
StepArchiveProgress(e);
break;
case ZipProgressEventType.Saving_EntryBytesRead:
StepEntryProgress(e);
break;
case ZipProgressEventType.Saving_Completed:
SaveCompleted();
break;
case ZipProgressEventType.Saving_AfterSaveTempArchive:
// this event only occurs when saving an SFX file
TempArchiveSaved();
break;
}
if (_saveCanceled)
e.Cancel = true;
}
private void StepArchiveProgress(SaveProgressEventArgs e)
{
if (this.progressBar1.InvokeRequired)
{
this.progressBar1.Invoke(new SaveEntryProgress(this.StepArchiveProgress), new object[] { e });
}
else
{
if (!_saveCanceled)
{
_nFilesCompleted++;
this.progressBar1.PerformStep();
_totalBytesAfterCompress += e.CurrentEntry.CompressedSize;
_totalBytesBeforeCompress += e.CurrentEntry.UncompressedSize;
// reset the progress bar for the entry:
this.progressBar2.Value = this.progressBar2.Maximum = 1;
this.Update();
}
}
}
private void StepEntryProgress(SaveProgressEventArgs e)
{
if (this.progressBar2.InvokeRequired)
{
this.progressBar2.Invoke(new SaveEntryProgress(this.StepEntryProgress), new object[] { e });
}
else
{
if (!_saveCanceled)
{
if (this.progressBar2.Maximum == 1)
{
// reset
Int64 max = e.TotalBytesToTransfer;
_progress2MaxFactor = 0;
while (max > System.Int32.MaxValue)
{
max /= 2;
_progress2MaxFactor++;
}
this.progressBar2.Maximum = (int)max;
lblStatus.Text = String.Format("{0} of {1} files...({2})",
_nFilesCompleted + 1, _entriesToZip, e.CurrentEntry.FileName);
}
int xferred = e.BytesTransferred >> _progress2MaxFactor;
this.progressBar2.Value = (xferred >= this.progressBar2.Maximum)
? this.progressBar2.Maximum
: xferred;
this.Update();
}
}
}
private void SaveCompleted()
{
if (this.lblStatus.InvokeRequired)
{
this.lblStatus.Invoke(new MethodInvoker(this.SaveCompleted));
}
else
{
lblStatus.Text = String.Format("Done, Compressed {0} files, {1:N0}% of original.",
_nFilesCompleted, (100.00 * _totalBytesAfterCompress) / _totalBytesBeforeCompress);
ResetState();
}
}
private void ResetState()
{
this.btnCancel.Enabled = false;
this.btnOk.Enabled = true;
this.btnOk.Text = "Zip it!";
this.progressBar1.Value = 0;
this.progressBar2.Value = 0;
this.Cursor = Cursors.Default;
if (!_workerThread.IsAlive)
_workerThread.Join();
}
An event handler invoked before, during, and after the reading of a zip archive.
Depending on the particular event being signaled, different properties on the
parameter are set. The following table
summarizes the available EventTypes and the conditions under which this
event handler is invoked with a ReadProgressEventArgs with the given EventType.
value of EntryType
Meaning and conditions
-
ZipProgressEventType.Reading_Started
Fired just as ZipFile.Read() begins. Meaningful properties: ArchiveName.
-
ZipProgressEventType.Reading_Completed
Fired when ZipFile.Read() has completed. Meaningful properties: ArchiveName.
-
ZipProgressEventType.Reading_ArchiveBytesRead
Fired while reading, updates the number of bytes read for the entire archive.
Meaningful properties: ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer.
-
ZipProgressEventType.Reading_BeforeReadEntry
Indicates an entry is about to be read from the archive.
Meaningful properties: ArchiveName, EntriesTotal.
-
ZipProgressEventType.Reading_AfterReadEntry
Indicates an entry has just been read from the archive.
Meaningful properties: ArchiveName, EntriesTotal, CurrentEntry.
An event handler invoked before, during, and after extraction of
entries in the zip archive.
Depending on the particular event, different properties on the parameter are set. The following
table summarizes the available EventTypes and the conditions under
which this event handler is invoked with a
ExtractProgressEventArgs with the given EventType.
value of EntryType
Meaning and conditions
-
ZipProgressEventType.Extracting_BeforeExtractAll
Set when ExtractAll() begins. The ArchiveName, Overwrite, and
ExtractLocation properties are meaningful.
-
ZipProgressEventType.Extracting_AfterExtractAll
Set when ExtractAll() has completed. The ArchiveName, Overwrite,
and ExtractLocation properties are meaningful.
-
ZipProgressEventType.Extracting_BeforeExtractEntry
Set when an Extract() on an entry in the ZipFile has begun.
Properties that are meaningful: ArchiveName, EntriesTotal,
CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted.
-
ZipProgressEventType.Extracting_AfterExtractEntry
Set when an Extract() on an entry in the ZipFile has completed.
Properties that are meaningful: ArchiveName, EntriesTotal,
CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted.
-
ZipProgressEventType.Extracting_EntryBytesWritten
Set within a call to Extract() on an entry in the ZipFile, as data
is extracted for the entry. Properties that are meaningful:
ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer.
-
ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite
Set within a call to Extract() on an entry in the ZipFile, when the
extraction would overwrite an existing file. This event type is used
only when ExtractExistingFileAction on the ZipFile or
ZipEntry is set to InvokeExtractProgressEvent.
private static bool justHadByteUpdate = false;
public static void ExtractProgress(object sender, ExtractProgressEventArgs e)
{
if(e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten)
{
if (justHadByteUpdate)
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer,
e.BytesTransferred / (0.01 * e.TotalBytesToTransfer ));
justHadByteUpdate = true;
}
else if(e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
{
if (justHadByteUpdate)
Console.WriteLine();
Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName);
justHadByteUpdate= false;
}
}
public static ExtractZip(string zipToExtract, string directory)
{
string TargetDirectory= "extract";
using (var zip = ZipFile.Read(zipToExtract)) {
zip.ExtractProgress += ExtractProgress;
foreach (var e in zip1)
{
e.Extract(TargetDirectory, true);
}
}
}
Public Shared Sub Main(ByVal args As String())
Dim ZipToUnpack As String = "C1P3SML.zip"
Dim TargetDir As String = "ExtractTest_Extract"
Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress
Dim e As ZipEntry
For Each e In zip1
e.Extract(TargetDir, True)
Next
End Using
End Sub
Private Shared justHadByteUpdate As Boolean = False
Public Shared Sub MyExtractProgress(ByVal sender As Object, ByVal e As ExtractProgressEventArgs)
If (e.EventType = ZipProgressEventType.Extracting_EntryBytesWritten) Then
If ExtractTest.justHadByteUpdate Then
Console.SetCursorPosition(0, Console.CursorTop)
End If
Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer)))
ExtractTest.justHadByteUpdate = True
ElseIf (e.EventType = ZipProgressEventType.Extracting_BeforeExtractEntry) Then
If ExtractTest.justHadByteUpdate Then
Console.WriteLine
End If
Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName)
ExtractTest.justHadByteUpdate = False
End If
End Sub
An event handler invoked before, during, and after Adding entries to a zip archive.
Adding a large number of entries to a zip file can take a long
time. For example, when calling on a
directory that contains 50,000 files, it could take 3 minutes or so.
This event handler allws an application to track the progress of the Add
operation, and to optionally cancel a lengthy Add operation.
int _numEntriesToAdd= 0;
int _numEntriesAdded= 0;
void AddProgressHandler(object sender, AddProgressEventArgs e)
{
switch (e.EventType)
{
case ZipProgressEventType.Adding_Started:
Console.WriteLine("Adding files to the zip...");
break;
case ZipProgressEventType.Adding_AfterAddEntry:
_numEntriesAdded++;
Console.WriteLine(String.Format("Adding file {0}/{1} :: {2}",
_numEntriesAdded, _numEntriesToAdd, e.CurrentEntry.FileName));
break;
case ZipProgressEventType.Adding_Completed:
Console.WriteLine("Added all files");
break;
}
}
void CreateTheZip()
{
using (ZipFile zip = new ZipFile())
{
zip.AddProgress += AddProgressHandler;
zip.AddDirectory(System.IO.Path.GetFileName(DirToZip));
zip.Save(ZipFileToCreate);
}
}
Private Sub AddProgressHandler(ByVal sender As Object, ByVal e As AddProgressEventArgs)
Select Case e.EventType
Case ZipProgressEventType.Adding_Started
Console.WriteLine("Adding files to the zip...")
Exit Select
Case ZipProgressEventType.Adding_AfterAddEntry
Console.WriteLine(String.Format("Adding file {0}", e.CurrentEntry.FileName))
Exit Select
Case ZipProgressEventType.Adding_Completed
Console.WriteLine("Added all files")
Exit Select
End Select
End Sub
Sub CreateTheZip()
Using zip as ZipFile = New ZipFile
AddHandler zip.AddProgress, AddressOf AddProgressHandler
zip.AddDirectory(System.IO.Path.GetFileName(DirToZip))
zip.Save(ZipFileToCreate);
End Using
End Sub
An event that is raised when an error occurs during open or read of files
while saving a zip archive.
Errors can occur as a file is being saved to the zip archive. For
example, the File.Open may fail, or a File.Read may fail, because of
lock conflicts or other reasons. If you add a handler to this event,
you can handle such errors in your own code. If you don't add a
handler, the library will throw an exception if it encounters an I/O
error during a call to Save().
Setting a handler implicitly sets to
ZipErrorAction.InvokeErrorEvent.
The handler you add applies to all items that are
subsequently added to the ZipFile instance. If you set this
property after you have added items to the ZipFile, but before you
have called Save(), errors that occur while saving those items
will not cause the error handler to be invoked.
If you want to handle any errors that occur with any entry in the zip
file using the same error handler, then add your error handler once,
before adding any entries to the zip archive.
In the error handler method, you need to set the property on the
ZipErrorEventArgs.CurrentEntry. This communicates back to
DotNetZip what you would like to do with this particular error. Within
an error handler, if you set the ZipEntry.ZipErrorAction property
on the ZipEntry to ZipErrorAction.InvokeErrorEvent or if
you don't set it at all, the library will throw the exception. (It is the
same as if you had set the ZipEntry.ZipErrorAction property on the
ZipEntry to ZipErrorAction.Throw.) If you set the
ZipErrorEventArgs.Cancel to true, the entire Save() will be
canceled.
In the case that you use ZipErrorAction.Skip, implying that
you want to skip the entry for which there's been an error, DotNetZip
tries to seek backwards in the output stream, and truncate all bytes
written on behalf of that particular entry. This works only if the
output stream is seekable. It will not work, for example, when using
ASPNET's Response.OutputStream.
This example shows how to use an event handler to handle
errors during save of the zip file.
public static void MyZipError(object sender, ZipErrorEventArgs e)
{
Console.WriteLine("Error saving {0}...", e.FileName);
Console.WriteLine(" Exception: {0}", e.exception);
ZipEntry entry = e.CurrentEntry;
string response = null;
// Ask the user whether he wants to skip this error or not
do
{
Console.Write("Retry, Skip, Throw, or Cancel ? (R/S/T/C) ");
response = Console.ReadLine();
Console.WriteLine();
} while (response != null &&
response[0]!='S' && response[0]!='s' &&
response[0]!='R' && response[0]!='r' &&
response[0]!='T' && response[0]!='t' &&
response[0]!='C' && response[0]!='c');
e.Cancel = (response[0]=='C' || response[0]=='c');
if (response[0]=='S' || response[0]=='s')
entry.ZipErrorAction = ZipErrorAction.Skip;
else if (response[0]=='R' || response[0]=='r')
entry.ZipErrorAction = ZipErrorAction.Retry;
else if (response[0]=='T' || response[0]=='t')
entry.ZipErrorAction = ZipErrorAction.Throw;
}
public void SaveTheFile()
{
string directoryToZip = "fodder";
string directoryInArchive = "files";
string zipFileToCreate = "Archive.zip";
using (var zip = new ZipFile())
{
// set the event handler before adding any entries
zip.ZipError += MyZipError;
zip.AddDirectory(directoryToZip, directoryInArchive);
zip.Save(zipFileToCreate);
}
}
Private Sub MyZipError(ByVal sender As Object, ByVal e As Ionic.Zip.ZipErrorEventArgs)
' At this point, the application could prompt the user for an action to take.
' But in this case, this application will simply automatically skip the file, in case of error.
Console.WriteLine("Zip Error, entry {0}", e.CurrentEntry.FileName)
Console.WriteLine(" Exception: {0}", e.exception)
' set the desired ZipErrorAction on the CurrentEntry to communicate that to DotNetZip
e.CurrentEntry.ZipErrorAction = Zip.ZipErrorAction.Skip
End Sub
Public Sub SaveTheFile()
Dim directoryToZip As String = "fodder"
Dim directoryInArchive As String = "files"
Dim zipFileToCreate as String = "Archive.zip"
Using zipArchive As ZipFile = New ZipFile
' set the event handler before adding any entries
AddHandler zipArchive.ZipError, AddressOf MyZipError
zipArchive.AddDirectory(directoryToZip, directoryInArchive)
zipArchive.Save(zipFileToCreate)
End Using
End Sub
Extracts all of the items in the zip archive, to the specified path in the
filesystem. The path can be relative or fully-qualified.
This method will extract all entries in the ZipFile to the
specified path.
If an extraction of a file from the zip archive would overwrite an
existing file in the filesystem, the action taken is dictated by the
ExtractExistingFile property, which overrides any setting you may have
made on individual ZipEntry instances. By default, if you have not
set that property on the ZipFile instance, the entry will not
be extracted, the existing file will not be overwritten and an
exception will be thrown. To change this, set the property, or use the
overload that allows you to
specify an ExtractExistingFileAction parameter.
The action to take when an extract would overwrite an existing file
applies to all entries. If you want to set this on a per-entry basis,
then you must use one of the ZipEntry.Extract methods.
This method will send verbose output messages to the , if it is set on the ZipFile
instance.
You may wish to take advantage of the ExtractProgress event.
About timestamps: When extracting a file entry from a zip archive, the
extracted file gets the last modified time of the entry as stored in
the archive. The archive may also store extended file timestamp
information, including last accessed and created times. If these are
present in the ZipEntry, then the extracted file will also get
these times.
A Directory entry is somewhat different. It will get the times as
described for a file entry, but, if there are file entries in the zip
archive that, when extracted, appear in the just-created directory,
then when those file entries are extracted, the last modified and last
accessed times of the directory will change, as a side effect. The
result is that after an extraction of a directory and a number of
files within the directory, the last modified and last accessed
timestamps on the directory will reflect the time that the last file
was extracted into the directory, rather than the time stored in the
zip archive for the directory.
To compensate, when extracting an archive with ExtractAll,
DotNetZip will extract all the file and directory entries as described
above, but it will then make a second pass on the directories, and
reset the times on the directories to reflect what is stored in the
zip archive.
This compensation is performed only within the context of an
ExtractAll. If you call ZipEntry.Extract on a directory
entry, the timestamps on directory in the filesystem will reflect the
times stored in the zip. If you then call ZipEntry.Extract on
a file entry, which is extracted into the directory, the timestamps on
the directory will be updated to the current time.
This example extracts all the entries in a zip archive file, to the
specified target directory. The extraction will overwrite any
existing files silently.
String TargetDirectory= "unpack";
using(ZipFile zip= ZipFile.Read(ZipFileToExtract))
{
zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently;
zip.ExtractAll(TargetDirectory);
}
Dim TargetDirectory As String = "unpack"
Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently
zip.ExtractAll(TargetDirectory)
End Using
The path to which the contents of the zipfile will be extracted.
The path can be relative or fully-qualified.
Extracts all of the items in the zip archive, to the specified path in the
filesystem, using the specified behavior when extraction would overwrite an
existing file.
This method will extract all entries in the ZipFile to the specified
path. For an extraction that would overwrite an existing file, the behavior
is dictated by , which overrides any
setting you may have made on individual ZipEntry instances.
The action to take when an extract would overwrite an existing file
applies to all entries. If you want to set this on a per-entry basis,
then you must use or one of the similar methods.
Calling this method is equivalent to setting the property and then calling .
This method will send verbose output messages to the
, if it is set on the ZipFile instance.
This example extracts all the entries in a zip archive file, to the
specified target directory. It does not overwrite any existing files.
String TargetDirectory= "c:\\unpack";
using(ZipFile zip= ZipFile.Read(ZipFileToExtract))
{
zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite);
}
Dim TargetDirectory As String = "c:\unpack"
Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite)
End Using
The path to which the contents of the zipfile will be extracted.
The path can be relative or fully-qualified.
The action to take if extraction would overwrite an existing file.
Reads a zip file archive and returns the instance.
The stream is read using the default System.Text.Encoding, which is the
IBM437 codepage.
Thrown if the ZipFile cannot be read. The implementation of this method
relies on System.IO.File.OpenRead, which can throw a variety of exceptions,
including specific exceptions if a file is not found, an unauthorized access
exception, exceptions for poorly formatted filenames, and so on.
The name of the zip archive to open. This can be a fully-qualified or relative
pathname.
.
The instance read from the zip archive.
Reads a zip file archive from the named filesystem file using the
specified options.
This version of the Read() method allows the caller to pass
in a TextWriter an Encoding, via an instance of the
ReadOptions class. The ZipFile is read in using the
specified encoding for entries where UTF-8 encoding is not
explicitly specified.
This example shows how to read a zip file using the Big-5 Chinese
code page (950), and extract each entry in the zip file, while
sending status messages out to the Console.
For this code to work as intended, the zipfile must have been
created using the big5 code page (CP950). This is typical, for
example, when using WinRar on a machine with CP950 set as the
default code page. In that case, the names of entries within the
Zip archive will be stored in that code page, and reading the zip
archive must be done using that code page. If the application did
not use the correct code page in ZipFile.Read(), then names of
entries within the zip archive would not be correctly retrieved.
string zipToExtract = "MyArchive.zip";
string extractDirectory = "extract";
var options = new ReadOptions
{
StatusMessageWriter = System.Console.Out,
Encoding = System.Text.Encoding.GetEncoding(950)
};
using (ZipFile zip = ZipFile.Read(zipToExtract, options))
{
foreach (ZipEntry e in zip)
{
e.Extract(extractDirectory);
}
}
Dim zipToExtract as String = "MyArchive.zip"
Dim extractDirectory as String = "extract"
Dim options as New ReadOptions
options.Encoding = System.Text.Encoding.GetEncoding(950)
options.StatusMessageWriter = System.Console.Out
Using zip As ZipFile = ZipFile.Read(zipToExtract, options)
Dim e As ZipEntry
For Each e In zip
e.Extract(extractDirectory)
Next
End Using
This example shows how to read a zip file using the default
code page, to remove entries that have a modified date before a given threshold,
sending status messages out to a StringWriter.
var options = new ReadOptions
{
StatusMessageWriter = new System.IO.StringWriter()
};
using (ZipFile zip = ZipFile.Read("PackedDocuments.zip", options))
{
var Threshold = new DateTime(2007,7,4);
// We cannot remove the entry from the list, within the context of
// an enumeration of said list.
// So we add the doomed entry to a list to be removed later.
// pass 1: mark the entries for removal
var MarkedEntries = new System.Collections.Generic.List<ZipEntry>();
foreach (ZipEntry e in zip)
{
if (e.LastModified < Threshold)
MarkedEntries.Add(e);
}
// pass 2: actually remove the entry.
foreach (ZipEntry zombie in MarkedEntries)
zip.RemoveEntry(zombie);
zip.Comment = "This archive has been updated.";
zip.Save();
}
// can now use contents of sw, eg store in an audit log
Dim options as New ReadOptions
options.StatusMessageWriter = New System.IO.StringWriter
Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip", options)
Dim Threshold As New DateTime(2007, 7, 4)
' We cannot remove the entry from the list, within the context of
' an enumeration of said list.
' So we add the doomed entry to a list to be removed later.
' pass 1: mark the entries for removal
Dim MarkedEntries As New System.Collections.Generic.List(Of ZipEntry)
Dim e As ZipEntry
For Each e In zip
If (e.LastModified < Threshold) Then
MarkedEntries.Add(e)
End If
Next
' pass 2: actually remove the entry.
Dim zombie As ZipEntry
For Each zombie In MarkedEntries
zip.RemoveEntry(zombie)
Next
zip.Comment = "This archive has been updated."
zip.Save
End Using
' can now use contents of sw, eg store in an audit log
Thrown if the zipfile cannot be read. The implementation of
this method relies on System.IO.File.OpenRead, which
can throw a variety of exceptions, including specific
exceptions if a file is not found, an unauthorized access
exception, exceptions for poorly formatted filenames, and so
on.
The name of the zip archive to open.
This can be a fully-qualified or relative pathname.
The set of options to use when reading the zip file.
The ZipFile instance read from the zip archive.
Reads a zip file archive using the specified text encoding, the specified
TextWriter for status messages, and the specified ReadProgress event handler,
and returns the instance.
The name of the zip archive to open.
This can be a fully-qualified or relative pathname.
An event handler for Read operations.
The System.IO.TextWriter to use for writing verbose status messages
during operations on the zip archive. A console application may wish to
pass System.Console.Out to get messages on the Console. A graphical
or headless application may wish to capture the messages in a different
TextWriter, such as a System.IO.StringWriter.
The System.Text.Encoding to use when reading in the zip archive. Be
careful specifying the encoding. If the value you use here is not the same
as the Encoding used when the zip archive was created (possibly by a
different archiver) you will get unexpected results and possibly exceptions.
The instance read from the zip archive.
Reads a zip archive from a stream.
When reading from a file, it's probably easier to just use
ZipFile.Read(String, ReadOptions). This
overload is useful when when the zip archive content is
available from an already-open stream. The stream must be
open and readable and seekable when calling this method. The
stream is left open when the reading is completed.
Using this overload, the stream is read using the default
System.Text.Encoding, which is the IBM437
codepage. If you want to specify the encoding to use when
reading the zipfile content, see
ZipFile.Read(Stream, ReadOptions). This
Reading of zip content begins at the current position in the
stream. This means if you have a stream that concatenates
regular data and zip data, if you position the open, readable
stream at the start of the zip data, you will be able to read
the zip archive using this constructor, or any of the ZipFile
constructors that accept a as
input. Some examples of where this might be useful: the zip
content is concatenated at the end of a regular EXE file, as
some self-extracting archives do. (Note: SFX files produced
by DotNetZip do not work this way; they can be read as normal
ZIP files). Another example might be a stream being read from
a database, where the zip content is embedded within an
aggregate stream of data.
This example shows how to Read zip content from a stream, and
extract one entry into a different stream. In this example,
the filename "NameOfEntryInArchive.doc", refers only to the
name of the entry within the zip archive. A file by that
name is not created in the filesystem. The I/O is done
strictly with the given streams.
using (ZipFile zip = ZipFile.Read(InputStream))
{
zip.Extract("NameOfEntryInArchive.doc", OutputStream);
}
Using zip as ZipFile = ZipFile.Read(InputStream)
zip.Extract("NameOfEntryInArchive.doc", OutputStream)
End Using
the stream containing the zip data.
The ZipFile instance read from the stream
Reads a zip file archive from the given stream using the
specified options.
When reading from a file, it's probably easier to just use
ZipFile.Read(String, ReadOptions). This
overload is useful when when the zip archive content is
available from an already-open stream. The stream must be
open and readable and seekable when calling this method. The
stream is left open when the reading is completed.
Reading of zip content begins at the current position in the
stream. This means if you have a stream that concatenates
regular data and zip data, if you position the open, readable
stream at the start of the zip data, you will be able to read
the zip archive using this constructor, or any of the ZipFile
constructors that accept a as
input. Some examples of where this might be useful: the zip
content is concatenated at the end of a regular EXE file, as
some self-extracting archives do. (Note: SFX files produced
by DotNetZip do not work this way; they can be read as normal
ZIP files). Another example might be a stream being read from
a database, where the zip content is embedded within an
aggregate stream of data.
the stream containing the zip data.
The set of options to use when reading the zip file.
Thrown if the zip archive cannot be read.
The ZipFile instance read from the stream.
Reads a zip archive from a stream, using the specified text Encoding, the
specified TextWriter for status messages,
and the specified ReadProgress event handler.
Reading of zip content begins at the current position in the stream. This
means if you have a stream that concatenates regular data and zip data, if
you position the open, readable stream at the start of the zip data, you
will be able to read the zip archive using this constructor, or any of the
ZipFile constructors that accept a as
input. Some examples of where this might be useful: the zip content is
concatenated at the end of a regular EXE file, as some self-extracting
archives do. (Note: SFX files produced by DotNetZip do not work this
way). Another example might be a stream being read from a database, where
the zip content is embedded within an aggregate stream of data.
the stream containing the zip data.
The System.IO.TextWriter to which verbose status messages are written
during operations on the ZipFile. For example, in a console
application, System.Console.Out works, and will get a message for each entry
added to the ZipFile. If the TextWriter is null, no verbose messages
are written.
The text encoding to use when reading entries that do not have the UTF-8
encoding bit set. Be careful specifying the encoding. If the value you use
here is not the same as the Encoding used when the zip archive was created
(possibly by a different archiver) you will get unexpected results and
possibly exceptions. See the
property for more information.
An event handler for Read operations.
an instance of ZipFile
Checks the given file to see if it appears to be a valid zip file.
Calling this method is equivalent to calling with the testExtract parameter set to false.
The file to check.
true if the file appears to be a zip file.
Checks a file to see if it is a valid zip file.
This method opens the specified zip file, reads in the zip archive,
verifying the ZIP metadata as it reads.
If everything succeeds, then the method returns true. If anything fails -
for example if an incorrect signature or CRC is found, indicating a
corrupt file, the the method returns false. This method also returns
false for a file that does not exist.
If is true, as part of its check, this
method reads in the content for each entry, expands it, and checks CRCs.
This provides an additional check beyond verifying the zip header and
directory data.
If is true, and if any of the zip entries
are protected with a password, this method will return false. If you want
to verify a ZipFile that has entries which are protected with a
password, you will need to do that manually.
The zip file to check.
true if the caller wants to extract each entry.
true if the file contains a valid zip file.
Checks a stream to see if it contains a valid zip archive.
This method reads the zip archive contained in the specified stream, verifying
the ZIP metadata as it reads. If testExtract is true, this method also extracts
each entry in the archive, dumping all the bits into .
If everything succeeds, then the method returns true. If anything fails -
for example if an incorrect signature or CRC is found, indicating a corrupt
file, the the method returns false. This method also returns false for a
file that does not exist.
If testExtract is true, this method reads in the content for each
entry, expands it, and checks CRCs. This provides an additional check
beyond verifying the zip header data.
If testExtract is true, and if any of the zip entries are protected
with a password, this method will return false. If you want to verify a
ZipFile that has entries which are protected with a password, you will need
to do that manually.
The stream to check.
true if the caller wants to extract each entry.
true if the stream contains a valid zip archive.
Delete file with retry on UnauthorizedAccessException.
When calling File.Delete() on a file that has been "recently"
created, the call sometimes fails with
UnauthorizedAccessException. This method simply retries the Delete 3
times with a sleep between tries.
the name of the file to be deleted
Saves the Zip archive to a file, specified by the Name property of the
ZipFile.
The ZipFile instance is written to storage, typically a zip file
in a filesystem, only when the caller calls Save. In the typical
case, the Save operation writes the zip content to a temporary file, and
then renames the temporary file to the desired name. If necessary, this
method will delete a pre-existing file before the rename.
The property is specified either explicitly,
or implicitly using one of the parameterized ZipFile constructors. For
COM Automation clients, the Name property must be set explicitly,
because COM Automation clients cannot call parameterized constructors.
When using a filesystem file for the Zip output, it is possible to call
Save multiple times on the ZipFile instance. With each
call the zip content is re-written to the same output file.
Data for entries that have been added to the ZipFile instance is
written to the output when the Save method is called. This means
that the input streams for those entries must be available at the time
the application calls Save. If, for example, the application
adds entries with AddEntry using a dynamically-allocated
MemoryStream, the memory stream must not have been disposed
before the call to Save. See the property for more discussion of the
availability requirements of the input stream for an entry, and an
approach for providing just-in-time stream lifecycle management.
Thrown if you haven't specified a location or stream for saving the zip,
either in the constructor or by setting the Name property, or if you try
to save a regular zip archive to a filename with a .exe extension.
Thrown if is non-zero, and the number
of segments that would be generated for the spanned zip file during the
save operation exceeds 99. If this happens, you need to increase the
segment size.
Save the file to a new zipfile, with the given name.
This method allows the application to explicitly specify the name of the zip
file when saving. Use this when creating a new zip file, or when
updating a zip archive.
An application can also save a zip archive in several places by calling this
method multiple times in succession, with different filenames.
The ZipFile instance is written to storage, typically a zip file in a
filesystem, only when the caller calls Save. The Save operation writes
the zip content to a temporary file, and then renames the temporary file
to the desired name. If necessary, this method will delete a pre-existing file
before the rename.
Thrown if you specify a directory for the filename.
The name of the zip archive to save to. Existing files will
be overwritten with great prejudice.
This example shows how to create and Save a zip file.
using (ZipFile zip = new ZipFile())
{
zip.AddDirectory(@"c:\reports\January");
zip.Save("January.zip");
}
Using zip As New ZipFile()
zip.AddDirectory("c:\reports\January")
zip.Save("January.zip")
End Using
This example shows how to update a zip file.
using (ZipFile zip = ZipFile.Read("ExistingArchive.zip"))
{
zip.AddFile("NewData.csv");
zip.Save("UpdatedArchive.zip");
}
Using zip As ZipFile = ZipFile.Read("ExistingArchive.zip")
zip.AddFile("NewData.csv")
zip.Save("UpdatedArchive.zip")
End Using
Save the zip archive to the specified stream.
The ZipFile instance is written to storage - typically a zip file
in a filesystem, but using this overload, the storage can be anything
accessible via a writable stream - only when the caller calls Save.
Use this method to save the zip content to a stream directly. A common
scenario is an ASP.NET application that dynamically generates a zip file
and allows the browser to download it. The application can call
Save(Response.OutputStream) to write a zipfile directly to the
output stream, without creating a zip file on the disk on the ASP.NET
server.
Be careful when saving a file to a non-seekable stream, including
Response.OutputStream. When DotNetZip writes to a non-seekable
stream, the zip archive is formatted in such a way that may not be
compatible with all zip tools on all platforms. It's a perfectly legal
and compliant zip file, but some people have reported problems opening
files produced this way using the Mac OS archive utility.
This example saves the zipfile content into a MemoryStream, and
then gets the array of bytes from that MemoryStream.
using (var zip = new Ionic.Zip.ZipFile())
{
zip.CompressionLevel= Ionic.Zlib.CompressionLevel.BestCompression;
zip.Password = "VerySecret.";
zip.Encryption = EncryptionAlgorithm.WinZipAes128;
zip.AddFile(sourceFileName);
MemoryStream output = new MemoryStream();
zip.Save(output);
byte[] zipbytes = output.ToArray();
}
This example shows a pitfall you should avoid. DO NOT read
from a stream, then try to save to the same stream. DO
NOT DO THIS:
using (var fs = new FileSteeam(filename, FileMode.Open))
{
using (var zip = Ionic.Zip.ZipFile.Read(inputStream))
{
zip.AddEntry("Name1.txt", "this is the content");
zip.Save(inputStream); // NO NO NO!!
}
}
Better like this:
using (var zip = Ionic.Zip.ZipFile.Read(filename))
{
zip.AddEntry("Name1.txt", "this is the content");
zip.Save(); // YES!
}
The System.IO.Stream to write to. It must be
writable. If you created the ZipFile instanct by calling
ZipFile.Read(), this stream must not be the same stream
you passed to ZipFile.Read().
Adds to the ZipFile a set of files from the current working directory on
disk, that conform to the specified criteria.
This method selects files from the the current working directory matching
the specified criteria, and adds them to the ZipFile.
Specify the criteria in statements of 3 elements: a noun, an operator, and
a value. Consider the string "name != *.doc" . The noun is "name". The
operator is "!=", implying "Not Equal". The value is "*.doc". That
criterion, in English, says "all files with a name that does not end in
the .doc extension."
Supported nouns include "name" (or "filename") for the filename; "atime",
"mtime", and "ctime" for last access time, last modfied time, and created
time of the file, respectively; "attributes" (or "attrs") for the file
attributes; "size" (or "length") for the file length (uncompressed), and
"type" for the type of object, either a file or a directory. The
"attributes", "name" and "type" nouns both support = and != as operators.
The "size", "atime", "mtime", and "ctime" nouns support = and !=, and
>, >=, <, <= as well. The times are taken to be expressed in
local time.
Specify values for the file attributes as a string with one or more of the
characters H,R,S,A,I,L in any order, implying file attributes of Hidden,
ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint (symbolic
link) respectively.
To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as the
format. If you omit the HH:mm:ss portion, it is assumed to be 00:00:00
(midnight).
The value for a size criterion is expressed in integer quantities of bytes,
kilobytes (use k or kb after the number), megabytes (m or mb), or gigabytes
(g or gb).
The value for a name is a pattern to match against the filename, potentially
including wildcards. The pattern follows CMD.exe glob rules: * implies one
or more of any character, while ? implies one character. If the name
pattern contains any slashes, it is matched to the entire filename,
including the path; otherwise, it is matched against only the filename
without the path. This means a pattern of "*\*.*" matches all files one
directory level deep, while a pattern of "*.*" matches all files in all
directories.
To specify a name pattern that includes spaces, use single quotes around the
pattern. A pattern of "'* *.*'" will match all files that have spaces in
the filename. The full criteria string for that would be "name = '* *.*'" .
The value for a type criterion is either F (implying a file) or D (implying
a directory).
Some examples:
criteria
Files retrieved
-
name != *.xls
any file with an extension that is not .xls
-
name = *.mp3
any file with a .mp3 extension.
-
*.mp3
(same as above) any file with a .mp3 extension.
-
attributes = A
all files whose attributes include the Archive bit.
-
attributes != H
all files whose attributes do not include the Hidden bit.
-
mtime > 2009-01-01
all files with a last modified time after January 1st, 2009.
-
size > 2gb
all files whose uncompressed size is greater than 2gb.
-
type = D
all directories in the filesystem.
You can combine criteria with the conjunctions AND or OR. Using a string
like "name = *.txt AND size >= 100k" for the selectionCriteria retrieves
entries whose names end in .txt, and whose uncompressed size is greater than
or equal to 100 kilobytes.
For more complex combinations of criteria, you can use parenthesis to group
clauses in the boolean logic. Without parenthesis, the precedence of the
criterion atoms is determined by order of appearance. Unlike the C#
language, the AND conjunction does not take precendence over the logical OR.
This is important only in strings that contain 3 or more criterion atoms.
In other words, "name = *.txt and size > 1000 or attributes = H" implies
"((name = *.txt AND size > 1000) OR attributes = H)" while "attributes =
H OR name = *.txt and size > 1000" evaluates to "((attributes = H OR name
= *.txt) AND size > 1000)". When in doubt, use parenthesis.
Using time properties requires some extra care. If you want to retrieve all
entries that were last updated on 2009 February 14, specify a time range
like so:"mtime >= 2009-02-14 AND mtime < 2009-02-15". Read this to
say: all files updated after 12:00am on February 14th, until 12:00am on
February 15th. You can use the same bracketing approach to specify any time
period - a year, a month, a week, and so on.
The syntax allows one special case: if you provide a string with no spaces, it is
treated as a pattern to match for the filename. Therefore a string like "*.xls"
will be equivalent to specifying "name = *.xls".
There is no logic in this method that insures that the file inclusion
criteria are internally consistent. For example, it's possible to specify
criteria that says the file must have a size of less than 100 bytes, as well
as a size that is greater than 1000 bytes. Obviously no file will ever
satisfy such criteria, but this method does not detect such logical
inconsistencies. The caller is responsible for insuring the criteria are
sensible.
Using this method, the file selection does not recurse into
subdirectories, and the full path of the selected files is included in the
entries added into the zip archive. If you don't like these behaviors,
see the other overloads of this method.
This example zips up all *.csv files in the current working directory.
using (ZipFile zip = new ZipFile())
{
// To just match on filename wildcards,
// use the shorthand form of the selectionCriteria string.
zip.AddSelectedFiles("*.csv");
zip.Save(PathToZipArchive);
}
Using zip As ZipFile = New ZipFile()
zip.AddSelectedFiles("*.csv")
zip.Save(PathToZipArchive)
End Using
The criteria for file selection
Adds to the ZipFile a set of files from the disk that conform to the
specified criteria, optionally recursing into subdirectories.
This method selects files from the the current working directory matching
the specified criteria, and adds them to the ZipFile. If
recurseDirectories is true, files are also selected from
subdirectories, and the directory structure in the filesystem is
reproduced in the zip archive, rooted at the current working directory.
Using this method, the full path of the selected files is included in the
entries added into the zip archive. If you don't want this behavior, use
one of the overloads of this method that allows the specification of a
directoryInArchive.
For details on the syntax for the selectionCriteria parameter, see .
This example zips up all *.xml files in the current working directory, or any
subdirectory, that are larger than 1mb.
using (ZipFile zip = new ZipFile())
{
// Use a compound expression in the selectionCriteria string.
zip.AddSelectedFiles("name = *.xml and size > 1024kb", true);
zip.Save(PathToZipArchive);
}
Using zip As ZipFile = New ZipFile()
' Use a compound expression in the selectionCriteria string.
zip.AddSelectedFiles("name = *.xml and size > 1024kb", true)
zip.Save(PathToZipArchive)
End Using
The criteria for file selection
If true, the file selection will recurse into subdirectories.
Adds to the ZipFile a set of files from a specified directory in the
filesystem, that conform to the specified criteria.
This method selects files that conform to the specified criteria, from the
the specified directory on disk, and adds them to the ZipFile. The search
does not recurse into subdirectores.
Using this method, the full filesystem path of the files on disk is
reproduced on the entries added to the zip file. If you don't want this
behavior, use one of the other overloads of this method.
For details on the syntax for the selectionCriteria parameter, see .
This example zips up all *.xml files larger than 1mb in the directory
given by "d:\rawdata".
using (ZipFile zip = new ZipFile())
{
// Use a compound expression in the selectionCriteria string.
zip.AddSelectedFiles("name = *.xml and size > 1024kb", "d:\\rawdata");
zip.Save(PathToZipArchive);
}
Using zip As ZipFile = New ZipFile()
' Use a compound expression in the selectionCriteria string.
zip.AddSelectedFiles("name = *.xml and size > 1024kb", "d:\rawdata)
zip.Save(PathToZipArchive)
End Using
The criteria for file selection
The name of the directory on the disk from which to select files.
Adds to the ZipFile a set of files from the specified directory on disk,
that conform to the specified criteria.
This method selects files from the the specified disk directory matching
the specified selection criteria, and adds them to the ZipFile. If
recurseDirectories is true, files are also selected from
subdirectories.
The full directory structure in the filesystem is reproduced on the
entries added to the zip archive. If you don't want this behavior, use
one of the overloads of this method that allows the specification of a
directoryInArchive.
For details on the syntax for the selectionCriteria parameter, see .
This example zips up all *.csv files in the "files" directory, or any
subdirectory, that have been saved since 2009 February 14th.
using (ZipFile zip = new ZipFile())
{
// Use a compound expression in the selectionCriteria string.
zip.AddSelectedFiles("name = *.csv and mtime > 2009-02-14", "files", true);
zip.Save(PathToZipArchive);
}
Using zip As ZipFile = New ZipFile()
' Use a compound expression in the selectionCriteria string.
zip.AddSelectedFiles("name = *.csv and mtime > 2009-02-14", "files", true)
zip.Save(PathToZipArchive)
End Using
This example zips up all files in the current working
directory, and all its child directories, except those in
the excludethis subdirectory.
Using Zip As ZipFile = New ZipFile(zipfile)
Zip.AddSelectedFfiles("name != 'excludethis\*.*'", datapath, True)
Zip.Save()
End Using
The criteria for file selection
The filesystem path from which to select files.
If true, the file selection will recurse into subdirectories.
Adds to the ZipFile a selection of files from the specified directory on
disk, that conform to the specified criteria, and using a specified root
path for entries added to the zip archive.
This method selects files from the specified disk directory matching the
specified selection criteria, and adds those files to the ZipFile, using
the specified directory path in the archive. The search does not recurse
into subdirectories. For details on the syntax for the selectionCriteria
parameter, see .
This example zips up all *.psd files in the "photos" directory that have
been saved since 2009 February 14th, and puts them all in a zip file,
using the directory name of "content" in the zip archive itself. When the
zip archive is unzipped, the folder containing the .psd files will be
named "content".
using (ZipFile zip = new ZipFile())
{
// Use a compound expression in the selectionCriteria string.
zip.AddSelectedFiles("name = *.psd and mtime > 2009-02-14", "photos", "content");
zip.Save(PathToZipArchive);
}
Using zip As ZipFile = New ZipFile
zip.AddSelectedFiles("name = *.psd and mtime > 2009-02-14", "photos", "content")
zip.Save(PathToZipArchive)
End Using
The criteria for selection of files to add to the ZipFile.
The path to the directory in the filesystem from which to select files.
Specifies a directory path to use to in place of the
directoryOnDisk. This path may, or may not, correspond to a real
directory in the current filesystem. If the files within the zip are
later extracted, this is the path used for the extracted file. Passing
null (nothing in VB) will use the path on the file name, if any; in other
words it would use directoryOnDisk, plus any subdirectory. Passing
the empty string ("") will insert the item at the root path within the
archive.
Adds to the ZipFile a selection of files from the specified directory on
disk, that conform to the specified criteria, optionally recursing through
subdirectories, and using a specified root path for entries added to the
zip archive.
This method selects files from the specified disk directory that match the
specified selection criteria, and adds those files to the ZipFile, using
the specified directory path in the archive. If recurseDirectories
is true, files are also selected from subdirectories, and the directory
structure in the filesystem is reproduced in the zip archive, rooted at
the directory specified by directoryOnDisk. For details on the
syntax for the selectionCriteria parameter, see .
This example zips up all files that are NOT *.pst files, in the current
working directory and any subdirectories.
using (ZipFile zip = new ZipFile())
{
zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true);
zip.Save(PathToZipArchive);
}
Using zip As ZipFile = New ZipFile
zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true)
zip.Save(PathToZipArchive)
End Using
The criteria for selection of files to add to the ZipFile.
The path to the directory in the filesystem from which to select files.
Specifies a directory path to use to in place of the
directoryOnDisk. This path may, or may not, correspond to a real
directory in the current filesystem. If the files within the zip are
later extracted, this is the path used for the extracted file. Passing
null (nothing in VB) will use the path on the file name, if any; in other
words it would use directoryOnDisk, plus any subdirectory. Passing
the empty string ("") will insert the item at the root path within the
archive.
If true, the method also scans subdirectories for files matching the
criteria.
Updates the ZipFile with a selection of files from the disk that conform
to the specified criteria.
This method selects files from the specified disk directory that match the
specified selection criteria, and Updates the ZipFile with those
files, using the specified directory path in the archive. If
recurseDirectories is true, files are also selected from
subdirectories, and the directory structure in the filesystem is
reproduced in the zip archive, rooted at the directory specified by
directoryOnDisk. For details on the syntax for the
selectionCriteria parameter, see .
The criteria for selection of files to add to the ZipFile.
The path to the directory in the filesystem from which to select files.
Specifies a directory path to use to in place of the
directoryOnDisk. This path may, or may not, correspond to a
real directory in the current filesystem. If the files within the zip
are later extracted, this is the path used for the extracted file.
Passing null (nothing in VB) will use the path on the file name, if
any; in other words it would use directoryOnDisk, plus any
subdirectory. Passing the empty string ("") will insert the item at
the root path within the archive.
If true, the method also scans subdirectories for files matching the criteria.
Retrieve entries from the zipfile by specified criteria.
This method allows callers to retrieve the collection of entries from the zipfile
that fit the specified criteria. The criteria are described in a string format, and
can include patterns for the filename; constraints on the size of the entry;
constraints on the last modified, created, or last accessed time for the file
described by the entry; or the attributes of the entry.
For details on the syntax for the selectionCriteria parameter, see .
This method is intended for use with a ZipFile that has been read from storage.
When creating a new ZipFile, this method will work only after the ZipArchive has
been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
archive from storage.) Calling SelectEntries on a ZipFile that has not yet been
saved will deliver undefined results.
Thrown if selectionCriteria has an invalid syntax.
This example selects all the PhotoShop files from within an archive, and extracts them
to the current working directory.
using (ZipFile zip1 = ZipFile.Read(ZipFileName))
{
var PhotoShopFiles = zip1.SelectEntries("*.psd");
foreach (ZipEntry psd in PhotoShopFiles)
{
psd.Extract();
}
}
Using zip1 As ZipFile = ZipFile.Read(ZipFileName)
Dim PhotoShopFiles as ICollection(Of ZipEntry)
PhotoShopFiles = zip1.SelectEntries("*.psd")
Dim psd As ZipEntry
For Each psd In PhotoShopFiles
psd.Extract
Next
End Using
the string that specifies which entries to select
a collection of ZipEntry objects that conform to the inclusion spec
Retrieve entries from the zipfile by specified criteria.
This method allows callers to retrieve the collection of entries from the zipfile
that fit the specified criteria. The criteria are described in a string format, and
can include patterns for the filename; constraints on the size of the entry;
constraints on the last modified, created, or last accessed time for the file
described by the entry; or the attributes of the entry.
For details on the syntax for the selectionCriteria parameter, see .
This method is intended for use with a ZipFile that has been read from storage.
When creating a new ZipFile, this method will work only after the ZipArchive has
been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
archive from storage.) Calling SelectEntries on a ZipFile that has not yet been
saved will deliver undefined results.
Thrown if selectionCriteria has an invalid syntax.
using (ZipFile zip1 = ZipFile.Read(ZipFileName))
{
var UpdatedPhotoShopFiles = zip1.SelectEntries("*.psd", "UpdatedFiles");
foreach (ZipEntry e in UpdatedPhotoShopFiles)
{
// prompt for extract here
if (WantExtract(e.FileName))
e.Extract();
}
}
Using zip1 As ZipFile = ZipFile.Read(ZipFileName)
Dim UpdatedPhotoShopFiles As ICollection(Of ZipEntry) = zip1.SelectEntries("*.psd", "UpdatedFiles")
Dim e As ZipEntry
For Each e In UpdatedPhotoShopFiles
' prompt for extract here
If Me.WantExtract(e.FileName) Then
e.Extract
End If
Next
End Using
the string that specifies which entries to select
the directory in the archive from which to select entries. If null, then
all directories in the archive are used.
a collection of ZipEntry objects that conform to the inclusion spec
Remove entries from the zipfile by specified criteria.
This method allows callers to remove the collection of entries from the zipfile
that fit the specified criteria. The criteria are described in a string format, and
can include patterns for the filename; constraints on the size of the entry;
constraints on the last modified, created, or last accessed time for the file
described by the entry; or the attributes of the entry.
For details on the syntax for the selectionCriteria parameter, see .
This method is intended for use with a ZipFile that has been read from storage.
When creating a new ZipFile, this method will work only after the ZipArchive has
been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
archive from storage.) Calling SelectEntries on a ZipFile that has not yet been
saved will deliver undefined results.
Thrown if selectionCriteria has an invalid syntax.
This example removes all entries in a zip file that were modified prior to January 1st, 2008.
using (ZipFile zip1 = ZipFile.Read(ZipFileName))
{
// remove all entries from prior to Jan 1, 2008
zip1.RemoveEntries("mtime < 2008-01-01");
// don't forget to save the archive!
zip1.Save();
}
Using zip As ZipFile = ZipFile.Read(ZipFileName)
' remove all entries from prior to Jan 1, 2008
zip1.RemoveEntries("mtime < 2008-01-01")
' do not forget to save the archive!
zip1.Save
End Using
the string that specifies which entries to select
the number of entries removed
Remove entries from the zipfile by specified criteria, and within the specified
path in the archive.
This method allows callers to remove the collection of entries from the zipfile
that fit the specified criteria. The criteria are described in a string format, and
can include patterns for the filename; constraints on the size of the entry;
constraints on the last modified, created, or last accessed time for the file
described by the entry; or the attributes of the entry.
For details on the syntax for the selectionCriteria parameter, see .
This method is intended for use with a ZipFile that has been read from storage.
When creating a new ZipFile, this method will work only after the ZipArchive has
been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
archive from storage.) Calling SelectEntries on a ZipFile that has not yet been
saved will deliver undefined results.
Thrown if selectionCriteria has an invalid syntax.
using (ZipFile zip1 = ZipFile.Read(ZipFileName))
{
// remove all entries from prior to Jan 1, 2008
zip1.RemoveEntries("mtime < 2008-01-01", "documents");
// a call to ZipFile.Save will make the modifications permanent
zip1.Save();
}
Using zip As ZipFile = ZipFile.Read(ZipFileName)
' remove all entries from prior to Jan 1, 2008
zip1.RemoveEntries("mtime < 2008-01-01", "documents")
' a call to ZipFile.Save will make the modifications permanent
zip1.Save
End Using
the string that specifies which entries to select
the directory in the archive from which to select entries. If null, then
all directories in the archive are used.
the number of entries removed
Selects and Extracts a set of Entries from the ZipFile.
The entries are extracted into the current working directory.
If any of the files to be extracted already exist, then the action taken is as
specified in the property on the
corresponding ZipEntry instance. By default, the action taken in this case is to
throw an exception.
For information on the syntax of the selectionCriteria string,
see .
This example shows how extract all XML files modified after 15 January 2009.
using (ZipFile zip = ZipFile.Read(zipArchiveName))
{
zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15");
}
the selection criteria for entries to extract.
Selects and Extracts a set of Entries from the ZipFile.
The entries are extracted into the current working directory. When extraction would would
overwrite an existing filesystem file, the action taken is as specified in the
parameter.
For information on the syntax of the string describing the entry selection criteria,
see .
This example shows how extract all XML files modified after 15 January 2009,
overwriting any existing files.
using (ZipFile zip = ZipFile.Read(zipArchiveName))
{
zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15",
ExtractExistingFileAction.OverwriteSilently);
}
the selection criteria for entries to extract.
The action to take if extraction would overwrite an existing file.
Selects and Extracts a set of Entries from the ZipFile.
The entries are selected from the specified directory within the archive, and then
extracted into the current working directory.
If any of the files to be extracted already exist, then the action taken is as
specified in the property on the
corresponding ZipEntry instance. By default, the action taken in this case is to
throw an exception.
For information on the syntax of the string describing the entry selection criteria,
see .
This example shows how extract all XML files modified after 15 January 2009,
and writes them to the "unpack" directory.
using (ZipFile zip = ZipFile.Read(zipArchiveName))
{
zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15","unpack");
}
the selection criteria for entries to extract.
the directory in the archive from which to select entries. If null, then
all directories in the archive are used.
Selects and Extracts a set of Entries from the ZipFile.
The entries are extracted into the specified directory. If any of the files to be
extracted already exist, an exception will be thrown.
For information on the syntax of the string describing the entry selection criteria,
see .
the selection criteria for entries to extract.
the directory in the archive from which to select entries. If null, then
all directories in the archive are used.
the directory on the disk into which to extract. It will be created
if it does not exist.
Selects and Extracts a set of Entries from the ZipFile.
The entries are extracted into the specified directory. When extraction would would
overwrite an existing filesystem file, the action taken is as specified in the
parameter.
For information on the syntax of the string describing the entry selection criteria,
see .
This example shows how extract all files with an XML extension or with a size larger than 100,000 bytes,
and puts them in the unpack directory. For any files that already exist in
that destination directory, they will not be overwritten.
using (ZipFile zip = ZipFile.Read(zipArchiveName))
{
zip.ExtractSelectedEntries("name = *.xml or size > 100000",
null,
"unpack",
ExtractExistingFileAction.DontOverwrite);
}
the selection criteria for entries to extract.
The directory on the disk into which to extract. It will be created if it does not exist.
The directory in the archive from which to select entries. If null, then
all directories in the archive are used.
The action to take if extraction would overwrite an existing file.
Generic IEnumerator support, for use of a ZipFile in an enumeration.
You probably do not want to call GetEnumerator explicitly. Instead
it is implicitly called when you use a loop in C#, or a
For Each loop in VB.NET.
This example reads a zipfile of a given name, then enumerates the
entries in that zip file, and displays the information about each
entry on the Console.
using (ZipFile zip = ZipFile.Read(zipfile))
{
bool header = true;
foreach (ZipEntry e in zip)
{
if (header)
{
System.Console.WriteLine("Zipfile: {0}", zip.Name);
System.Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded);
System.Console.WriteLine("BitField: 0x{0:X2}", e.BitField);
System.Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod);
System.Console.WriteLine("\n{1,-22} {2,-6} {3,4} {4,-8} {0}",
"Filename", "Modified", "Size", "Ratio", "Packed");
System.Console.WriteLine(new System.String('-', 72));
header = false;
}
System.Console.WriteLine("{1,-22} {2,-6} {3,4:F0}% {4,-8} {0}",
e.FileName,
e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"),
e.UncompressedSize,
e.CompressionRatio,
e.CompressedSize);
e.Extract();
}
}
Dim ZipFileToExtract As String = "c:\foo.zip"
Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
Dim header As Boolean = True
Dim e As ZipEntry
For Each e In zip
If header Then
Console.WriteLine("Zipfile: {0}", zip.Name)
Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded)
Console.WriteLine("BitField: 0x{0:X2}", e.BitField)
Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod)
Console.WriteLine(ChrW(10) & "{1,-22} {2,-6} {3,4} {4,-8} {0}", _
"Filename", "Modified", "Size", "Ratio", "Packed" )
Console.WriteLine(New String("-"c, 72))
header = False
End If
Console.WriteLine("{1,-22} {2,-6} {3,4:F0}% {4,-8} {0}", _
e.FileName, _
e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), _
e.UncompressedSize, _
e.CompressionRatio, _
e.CompressedSize )
e.Extract
Next
End Using
A generic enumerator suitable for use within a foreach loop.
An IEnumerator, for use of a ZipFile in a foreach construct.
This method is included for COM support. An application generally does not call
this method directly. It is called implicitly by COM clients when enumerating
the entries in the ZipFile instance. In VBScript, this is done with a For Each
statement. In Javascript, this is done with new Enumerator(zipfile).
The IEnumerator over the entries in the ZipFile.
Options for using ZIP64 extensions when saving zip archives.
Designed many years ago, the original zip
specification from PKWARE allowed for 32-bit quantities for the
compressed and uncompressed sizes of zip entries, as well as a 32-bit quantity
for specifying the length of the zip archive itself, and a maximum of 65535
entries. These limits are now regularly exceeded in many backup and archival
scenarios. Recently, PKWare added extensions to the original zip spec, called
"ZIP64 extensions", to raise those limitations. This property governs whether
DotNetZip will use those extensions when writing zip archives. The use of
these extensions is optional and explicit in DotNetZip because, despite the
status of ZIP64 as a bona fide standard, many other zip tools and libraries do
not support ZIP64, and therefore a zip file with ZIP64 extensions may be
unreadable by some of those other tools.
Set this property to to always use ZIP64
extensions when saving, regardless of whether your zip archive needs it.
Suppose you add 5 files, each under 100k, to a ZipFile. If you specify Always
for this flag, you will get a ZIP64 archive, though the archive does not need
to use ZIP64 because none of the original zip limits had been exceeded.
Set this property to to tell the DotNetZip
library to never use ZIP64 extensions. This is useful for maximum
compatibility and interoperability, at the expense of the capability of
handling large files or large archives. NB: Windows Explorer in Windows XP
and Windows Vista cannot currently extract files from a zip64 archive, so if
you want to guarantee that a zip archive produced by this library will work in
Windows Explorer, use Never. If you set this property to , and your application creates a zip that would
exceed one of the Zip limits, the library will throw an exception while saving
the zip file.
Set this property to to tell the
DotNetZip library to use the ZIP64 extensions when required by the
entry. After the file is compressed, the original and compressed sizes are
checked, and if they exceed the limits described above, then zip64 can be
used. That is the general idea, but there is an additional wrinkle when saving
to a non-seekable device, like the ASP.NET Response.OutputStream, or
Console.Out. When using non-seekable streams for output, the entry
header - which indicates whether zip64 is in use - is emitted before it is
known if zip64 is necessary. It is only after all entries have been saved
that it can be known if ZIP64 will be required. On seekable output streams,
after saving all entries, the library can seek backward and re-emit the zip
file header to be consistent with the actual ZIP64 requirement. But using a
non-seekable output stream, the library cannot seek backward, so the header
can never be changed. In other words, the archive's use of ZIP64 extensions is
not alterable after the header is emitted. Therefore, when saving to
non-seekable streams, using is the same
as using : it will always produce a zip
archive that uses ZIP64 extensions.
The default behavior, which is "Never".
(For COM clients, this is a 0 (zero).)
Do not use ZIP64 extensions when writing zip archives.
(For COM clients, this is a 0 (zero).)
Use ZIP64 extensions when writing zip archives, as necessary.
For example, when a single entry exceeds 0xFFFFFFFF in size, or when the archive as a whole
exceeds 0xFFFFFFFF in size, or when there are more than 65535 entries in an archive.
(For COM clients, this is a 1.)
Always use ZIP64 extensions when writing zip archives, even when unnecessary.
(For COM clients, this is a 2.)
An enum representing the values on a three-way toggle switch
for various options in the library. This might be used to
specify whether to employ a particular text encoding, or to use
ZIP64 extensions, or some other option.
The default behavior. This is the same as "Never".
(For COM clients, this is a 0 (zero).)
Never use the associated option.
(For COM clients, this is a 0 (zero).)
Use the associated behavior "as necessary."
(For COM clients, this is a 1.)
Use the associated behavior Always, whether necessary or not.
(For COM clients, this is a 2.)
A class for collecting the various options that can be used when
Reading zip files for extraction or update.
When reading a zip file, there are several options an
application can set, to modify how the file is read, or what
the library does while reading. This class collects those
options into one container.
Pass an instance of the ReadOptions class into the
ZipFile.Read() method.
.
.
An event handler for Read operations. When opening large zip
archives, you may want to display a progress bar or other
indicator of status progress while reading. This parameter
allows you to specify a ReadProgress Event Handler directly.
When you call Read(), the progress event is invoked as
necessary.
The System.IO.TextWriter to use for writing verbose status messages
during operations on the zip archive. A console application may wish to
pass System.Console.Out to get messages on the Console. A graphical
or headless application may wish to capture the messages in a different
TextWriter, such as a System.IO.StringWriter.
The System.Text.Encoding to use when reading in the zip archive. Be
careful specifying the encoding. If the value you use here is not the same
as the Encoding used when the zip archive was created (possibly by a
different archiver) you will get unexpected results and possibly exceptions.
Provides a stream metaphor for reading zip files.
This class provides an alternative programming model for reading zip files to
the one enabled by the class. Use this when reading zip
files, as an alternative to the class, when you would
like to use a Stream class to read the file.
Some application designs require a readable stream for input. This stream can
be used to read a zip file, and extract entries.
Both the ZipInputStream class and the ZipFile class can be used
to read and extract zip files. Both of them support many of the common zip
features, including Unicode, different compression levels, and ZIP64. The
programming models differ. For example, when extracting entries via calls to
the GetNextEntry() and Read() methods on the
ZipInputStream class, the caller is responsible for creating the file,
writing the bytes into the file, setting the attributes on the file, and
setting the created, last modified, and last accessed timestamps on the
file. All of these things are done automatically by a call to ZipEntry.Extract(). For this reason, the
ZipInputStream is generally recommended for when your application wants
to extract the data, without storing that data into a file.
Aside from the obvious differences in programming model, there are some
differences in capability between the ZipFile class and the
ZipInputStream class.
-
ZipFile can be used to create or update zip files, or read and
extract zip files. ZipInputStream can be used only to read and
extract zip files. If you want to use a stream to create zip files, check
out the .
-
ZipInputStream cannot read segmented or spanned
zip files.
-
ZipInputStream will not read Zip file comments.
-
When reading larger files, ZipInputStream will always underperform
ZipFile. This is because the ZipInputStream does a full scan on the
zip file, while the ZipFile class reads the central directory of the
zip file.
Create a ZipInputStream, wrapping it around an existing stream.
While the class is generally easier
to use, this class provides an alternative to those
applications that want to read from a zipfile directly,
using a .
Both the ZipInputStream class and the ZipFile class can be used
to read and extract zip files. Both of them support many of the common zip
features, including Unicode, different compression levels, and ZIP64. The
programming models differ. For example, when extracting entries via calls to
the GetNextEntry() and Read() methods on the
ZipInputStream class, the caller is responsible for creating the file,
writing the bytes into the file, setting the attributes on the file, and
setting the created, last modified, and last accessed timestamps on the
file. All of these things are done automatically by a call to ZipEntry.Extract(). For this reason, the
ZipInputStream is generally recommended for when your application wants
to extract the data, without storing that data into a file.
Aside from the obvious differences in programming model, there are some
differences in capability between the ZipFile class and the
ZipInputStream class.
-
ZipFile can be used to create or update zip files, or read and extract
zip files. ZipInputStream can be used only to read and extract zip
files. If you want to use a stream to create zip files, check out the .
-
ZipInputStream cannot read segmented or spanned
zip files.
-
ZipInputStream will not read Zip file comments.
-
When reading larger files, ZipInputStream will always underperform
ZipFile. This is because the ZipInputStream does a full scan on the
zip file, while the ZipFile class reads the central directory of the
zip file.
The stream to read. It must be readable. This stream will be closed at
the time the ZipInputStream is closed.
This example shows how to read a zip file, and extract entries, using the
ZipInputStream class.
private void Unzip()
{
byte[] buffer= new byte[2048];
int n;
using (var raw = File.Open(inputFileName, FileMode.Open, FileAccess.Read))
{
using (var input= new ZipInputStream(raw))
{
ZipEntry e;
while (( e = input.GetNextEntry()) != null)
{
if (e.IsDirectory) continue;
string outputPath = Path.Combine(extractDir, e.FileName);
using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
{
while ((n= input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer,0,n);
}
}
}
}
}
}
Private Sub UnZip()
Dim inputFileName As String = "MyArchive.zip"
Dim extractDir As String = "extract"
Dim buffer As Byte() = New Byte(2048) {}
Using raw As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read)
Using input As ZipInputStream = New ZipInputStream(raw)
Dim e As ZipEntry
Do While (Not e = input.GetNextEntry Is Nothing)
If Not e.IsDirectory Then
Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _
FileMode.Create, FileAccess.ReadWrite)
Dim n As Integer
Do While (n = input.Read(buffer, 0, buffer.Length) > 0)
output.Write(buffer, 0, n)
Loop
End Using
End If
Loop
End Using
End Using
End Sub
Create a ZipInputStream, given the name of an existing zip file.
This constructor opens a FileStream for the given zipfile, and
wraps a ZipInputStream around that. See the documentation for the
constructor for full details.
While the class is generally easier
to use, this class provides an alternative to those
applications that want to read from a zipfile directly,
using a .
The name of the filesystem file to read.
This example shows how to read a zip file, and extract entries, using the
ZipInputStream class.
private void Unzip()
{
byte[] buffer= new byte[2048];
int n;
using (var input= new ZipInputStream(inputFileName))
{
ZipEntry e;
while (( e = input.GetNextEntry()) != null)
{
if (e.IsDirectory) continue;
string outputPath = Path.Combine(extractDir, e.FileName);
using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
{
while ((n= input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer,0,n);
}
}
}
}
}
Private Sub UnZip()
Dim inputFileName As String = "MyArchive.zip"
Dim extractDir As String = "extract"
Dim buffer As Byte() = New Byte(2048) {}
Using input As ZipInputStream = New ZipInputStream(inputFileName)
Dim e As ZipEntry
Do While (Not e = input.GetNextEntry Is Nothing)
If Not e.IsDirectory Then
Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _
FileMode.Create, FileAccess.ReadWrite)
Dim n As Integer
Do While (n = input.Read(buffer, 0, buffer.Length) > 0)
output.Write(buffer, 0, n)
Loop
End Using
End If
Loop
End Using
End Sub
Create a ZipInputStream, explicitly specifying whether to
keep the underlying stream open.
See the documentation for the ZipInputStream(Stream)
constructor for a discussion of the class, and an example of how to use the class.
The stream to read from. It must be readable.
true if the application would like the stream
to remain open after the ZipInputStream has been closed.
Provides a string representation of the instance.
This can be useful for debugging purposes.
a string representation of the instance.
Size of the work buffer to use for the ZLIB codec during decompression.
q
Setting this affects the performance and memory efficiency of compression
and decompression. For larger files, setting this to a larger size may
improve performance, but the exact numbers vary depending on available
memory, and a bunch of other variables. I don't have good firm
recommendations on how to set it. You'll have to test it yourself. Or
just leave it alone and accept the default.
Sets the password to be used on the ZipInputStream instance.
When reading a zip archive, this password is used to read and decrypt the
entries that are encrypted within the zip file. When entries within a zip
file use different passwords, set the appropriate password for the entry
before the first call to Read() for each entry.
When reading an entry that is not encrypted, the value of this property is
ignored.
This example uses the ZipInputStream to read and extract entries from a
zip file, using a potentially different password for each entry.
byte[] buffer= new byte[2048];
int n;
using (var raw = File.Open(_inputFileName, FileMode.Open, FileAccess.Read ))
{
using (var input= new ZipInputStream(raw))
{
ZipEntry e;
while (( e = input.GetNextEntry()) != null)
{
input.Password = PasswordForEntry(e.FileName);
if (e.IsDirectory) continue;
string outputPath = Path.Combine(_extractDir, e.FileName);
using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
{
while ((n= input.Read(buffer,0,buffer.Length)) > 0)
{
output.Write(buffer,0,n);
}
}
}
}
}
Read the data from the stream into the buffer.
The data for the zipentry will be decrypted and uncompressed, as
necessary, before being copied into the buffer.
You must set the property before calling
Read() the first time for an encrypted entry. To determine if an
entry is encrypted and requires a password, check the ZipEntry.Encryption property.
The buffer to hold the data read from the stream.
the offset within the buffer to copy the first byte read.
the number of bytes to read.
the number of bytes read, after decryption and decompression.
Read the next entry from the zip file.
Call this method just before calling ,
to position the pointer in the zip file to the next entry that can be
read. Subsequent calls to Read(), will decrypt and decompress the
data in the zip file, until Read() returns 0.
Each time you call GetNextEntry(), the pointer in the wrapped
stream is moved to the next entry in the zip file. If you call , and thus re-position the pointer within
the file, you will need to call GetNextEntry() again, to insure
that the file pointer is positioned at the beginning of a zip entry.
This method returns the ZipEntry. Using a stream approach, you will
read the raw bytes for an entry in a zip file via calls to Read().
Alternatively, you can extract an entry into a file, or a stream, by
calling , or one of its siblings.
The ZipEntry read. Returns null (or Nothing in VB) if there are no more
entries in the zip file.
Dispose the stream.
This method disposes the ZipInputStream. It may also close the
underlying stream, depending on which constructor was used.
Typically the application will call Dispose() implicitly, via
a using statement in C#, or a Using statement in VB.
Application code won't call this code directly. This method may
be invoked in two distinct scenarios. If disposing == true, the
method has been called directly or indirectly by a user's code,
for example via the public Dispose() method. In this case, both
managed and unmanaged resources can be referenced and disposed.
If disposing == false, the method has been called by the runtime
from inside the object finalizer and this method should not
reference other objects; in that case only unmanaged resources
must be referenced or disposed.
true if the Dispose method was invoked by user code.
Always returns true.
Returns the value of CanSeek for the underlying (wrapped) stream.
Always returns false.
Returns the length of the underlying stream.
Gets or sets the position of the underlying stream.
Setting the position is equivalent to calling Seek(value, SeekOrigin.Begin).
This is a no-op.
This method always throws a NotSupportedException.
ignored
ignored
ignored
This method seeks in the underlying stream.
Call this method if you want to seek around within the zip file for random access.
Applications can intermix calls to Seek() with calls to . After a call to Seek(),
GetNextEntry() will get the next ZipEntry that falls after
the current position in the input stream. You're on your own for finding
out just where to seek in the stream, to get to the various entries.
the offset point to seek to
the reference point from which to seek
The new position
This method always throws a NotSupportedException.
ignored
Provides a stream metaphor for generating zip files.
This class writes zip files, as defined in the specification
for zip files described by PKWare. The compression for this
implementation is provided by a managed-code version of Zlib, included with
DotNetZip in the classes in the Ionic.Zlib namespace.
This class provides an alternative programming model to the one enabled by the
class. Use this when creating zip files, as an
alternative to the class, when you would like to use a
Stream type to write the zip file.
Both the ZipOutputStream class and the ZipFile class can be used
to create zip files. Both of them support many of the common zip features,
including Unicode, different compression levels, and ZIP64. They provide
very similar performance when creating zip files.
The ZipFile class is generally easier to use than
ZipOutputStream and should be considered a higher-level interface. For
example, when creating a zip file via calls to the PutNextEntry() and
Write() methods on the ZipOutputStream class, the caller is
responsible for opening the file, reading the bytes from the file, writing
those bytes into the ZipOutputStream, setting the attributes on the
ZipEntry, and setting the created, last modified, and last accessed
timestamps on the zip entry. All of these things are done automatically by a
call to ZipFile.AddFile().
For this reason, the ZipOutputStream is generally recommended for use
only when your application emits arbitrary data, not necessarily data from a
filesystem file, directly into a zip file, and does so using a Stream
metaphor.
Aside from the differences in programming model, there are other
differences in capability between the two classes.
-
ZipFile can be used to read and extract zip files, in addition to
creating zip files. ZipOutputStream cannot read zip files. If you want
to use a stream to read zip files, check out the class.
-
ZipOutputStream does not support the creation of segmented or spanned
zip files.
-
ZipOutputStream cannot produce a self-extracting archive.
Be aware that the ZipOutputStream class implements the interface. In order for
ZipOutputStream to produce a valid zip file, you use use it within
a using clause (Using in VB), or call the Dispose() method
explicitly. See the examples for how to employ a using clause.
Also, a note regarding compression performance: On the desktop .NET
Framework, DotNetZip can use a multi-threaded compression implementation
that provides significant speed increases on large files, over 300k or so,
at the cost of increased memory use at runtime. (The output of the
compression is almost exactly the same size). But, the multi-threaded
approach incurs a performance hit on smaller files. There's no way for the
ZipOutputStream to know whether parallel compression will be beneficial,
because the ZipOutputStream does not know how much data you will write
through the stream. You may wish to set the property to zero, if you are compressing
large files through ZipOutputStream. This will cause parallel
compression to be used, always.
Create a ZipOutputStream, wrapping an existing stream.
The class is generally easier to use when creating
zip files. The ZipOutputStream offers a different metaphor for creating a
zip file, based on the class.
The stream to wrap. It must be writable. This stream will be closed at
the time the ZipOutputStream is closed.
This example shows how to create a zip file, using the
ZipOutputStream class.
private void Zipup()
{
if (filesToZip.Count == 0)
{
System.Console.WriteLine("Nothing to do.");
return;
}
using (var raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite ))
{
using (var output= new ZipOutputStream(raw))
{
output.Password = "VerySecret!";
output.Encryption = EncryptionAlgorithm.WinZipAes256;
foreach (string inputFileName in filesToZip)
{
System.Console.WriteLine("file: {0}", inputFileName);
output.PutNextEntry(inputFileName);
using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Write ))
{
byte[] buffer= new byte[2048];
int n;
while ((n= input.Read(buffer,0,buffer.Length)) > 0)
{
output.Write(buffer,0,n);
}
}
}
}
}
}
Private Sub Zipup()
Dim outputFileName As String = "XmlData.zip"
Dim filesToZip As String() = Directory.GetFiles(".", "*.xml")
If (filesToZip.Length = 0) Then
Console.WriteLine("Nothing to do.")
Else
Using raw As FileStream = File.Open(outputFileName, FileMode.Create, FileAccess.ReadWrite)
Using output As ZipOutputStream = New ZipOutputStream(raw)
output.Password = "VerySecret!"
output.Encryption = EncryptionAlgorithm.WinZipAes256
Dim inputFileName As String
For Each inputFileName In filesToZip
Console.WriteLine("file: {0}", inputFileName)
output.PutNextEntry(inputFileName)
Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim n As Integer
Dim buffer As Byte() = New Byte(2048) {}
Do While (n = input.Read(buffer, 0, buffer.Length) > 0)
output.Write(buffer, 0, n)
Loop
End Using
Next
End Using
End Using
End If
End Sub
Create a ZipOutputStream that writes to a filesystem file.
The class is generally easier to use when creating
zip files. The ZipOutputStream offers a different metaphor for creating a
zip file, based on the class.
The name of the zip file to create.
This example shows how to create a zip file, using the
ZipOutputStream class.
private void Zipup()
{
if (filesToZip.Count == 0)
{
System.Console.WriteLine("Nothing to do.");
return;
}
using (var output= new ZipOutputStream(outputFileName))
{
output.Password = "VerySecret!";
output.Encryption = EncryptionAlgorithm.WinZipAes256;
foreach (string inputFileName in filesToZip)
{
System.Console.WriteLine("file: {0}", inputFileName);
output.PutNextEntry(inputFileName);
using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read,
FileShare.Read | FileShare.Write ))
{
byte[] buffer= new byte[2048];
int n;
while ((n= input.Read(buffer,0,buffer.Length)) > 0)
{
output.Write(buffer,0,n);
}
}
}
}
}
Private Sub Zipup()
Dim outputFileName As String = "XmlData.zip"
Dim filesToZip As String() = Directory.GetFiles(".", "*.xml")
If (filesToZip.Length = 0) Then
Console.WriteLine("Nothing to do.")
Else
Using output As ZipOutputStream = New ZipOutputStream(outputFileName)
output.Password = "VerySecret!"
output.Encryption = EncryptionAlgorithm.WinZipAes256
Dim inputFileName As String
For Each inputFileName In filesToZip
Console.WriteLine("file: {0}", inputFileName)
output.PutNextEntry(inputFileName)
Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Dim n As Integer
Dim buffer As Byte() = New Byte(2048) {}
Do While (n = input.Read(buffer, 0, buffer.Length) > 0)
output.Write(buffer, 0, n)
Loop
End Using
Next
End Using
End If
End Sub
Create a ZipOutputStream.
See the documentation for the ZipOutputStream(Stream)
constructor for an example.
The stream to wrap. It must be writable.
true if the application would like the stream
to remain open after the ZipOutputStream has been closed.
Provides a string representation of the instance.
This can be useful for debugging purposes.
a string representation of the instance.
Sets the password to be used on the ZipOutputStream instance.
When writing a zip archive, this password is applied to the entries, not
to the zip archive itself. It applies to any ZipEntry subsequently
written to the ZipOutputStream.
Using a password does not encrypt or protect the "directory" of the
archive - the list of entries contained in the archive. If you set the
Password property, the password actually applies to individual
entries that are added to the archive, subsequent to the setting of this
property. The list of filenames in the archive that is eventually created
will appear in clear text, but the contents of the individual files are
encrypted. This is how Zip encryption works.
If you set this property, and then add a set of entries to the archive via
calls to PutNextEntry, then each entry is encrypted with that
password. You may also want to change the password between adding
different entries. If you set the password, add an entry, then set the
password to null (Nothing in VB), and add another entry, the
first entry is encrypted and the second is not.
When setting the Password, you may also want to explicitly set the property, to specify how to encrypt the entries added
to the ZipFile. If you set the Password to a non-null value and do not
set , then PKZip 2.0 ("Weak") encryption is used.
This encryption is relatively weak but is very interoperable. If
you set the password to a null value (Nothing in VB),
Encryption is reset to None.
Special case: if you wrap a ZipOutputStream around a non-seekable stream,
and use encryption, and emit an entry of zero bytes, the Close() or
PutNextEntry() following the entry will throw an exception.
The Encryption to use for entries added to the ZipOutputStream.
The specified Encryption is applied to the entries subsequently
written to the ZipOutputStream instance.
If you set this to something other than
EncryptionAlgorithm.None, you will also need to set the
to a non-null, non-empty value in
order to actually get encryption on the entry.
ZipOutputStream.Password
ZipEntry.Encryption
Size of the work buffer to use for the ZLIB codec during compression.
Setting this may affect performance. For larger files, setting this to a
larger size may improve performance, but I'm not sure. Sorry, I don't
currently have good recommendations on how to set it. You can test it if
you like.
The compression strategy to use for all entries.
Set the Strategy used by the ZLIB-compatible compressor, when compressing
data for the entries in the zip archive. Different compression strategies
work better on different sorts of data. The strategy parameter can affect
the compression ratio and the speed of compression but not the correctness
of the compresssion. For more information see .
The type of timestamp attached to the ZipEntry.
Set this in order to specify the kind of timestamp that should be emitted
into the zip file for each entry.
Sets the compression level to be used for entries subsequently added to
the zip archive.
Varying the compression level used on entries can affect the
size-vs-speed tradeoff when compression and decompressing data streams
or files.
As with some other properties on the ZipOutputStream class, like , and ,
setting this property on a ZipOutputStream
instance will cause the specified CompressionLevel to be used on all
items that are subsequently added to the
ZipOutputStream instance.
If you do not set this property, the default compression level is used,
which normally gives a good balance of compression efficiency and
compression speed. In some tests, using BestCompression can
double the time it takes to compress, while delivering just a small
increase in compression efficiency. This behavior will vary with the
type of data you compress. If you are in doubt, just leave this setting
alone, and accept the default.
The compression method used on each entry added to the ZipOutputStream.
A comment attached to the zip archive.
The application sets this property to specify a comment to be embedded
into the generated zip archive.
According to PKWARE's
zip specification, the comment is not encrypted, even if there is a
password set on the zip file.
The specification does not describe how to indicate the encoding used
on a comment string. Many "compliant" zip tools and libraries use
IBM437 as the code page for comments; DotNetZip, too, follows that
practice. On the other hand, there are situations where you want a
Comment to be encoded with something else, for example using code page
950 "Big-5 Chinese". To fill that need, DotNetZip will encode the
comment following the same procedure it follows for encoding
filenames: (a) if is
Never, it uses the default encoding (IBM437). (b) if is Always, it always uses the
alternate encoding (). (c) if is AsNecessary, it uses the
alternate encoding only if the default encoding is not sufficient for
encoding the comment - in other words if decoding the result does not
produce the original string. This decision is taken at the time of
the call to ZipFile.Save().
Specify whether to use ZIP64 extensions when saving a zip archive.
The default value for the property is . is
safest, in the sense that you will not get an Exception if a
pre-ZIP64 limit is exceeded.
You must set this property before calling Write().
Indicates whether ZIP64 extensions were used when saving the zip archive.
The value is defined only after the ZipOutputStream has been closed.
Whether the ZipOutputStream should use case-insensitive comparisons when
checking for uniqueness of zip entries.
Though the zip specification doesn't prohibit zipfiles with duplicate
entries, Sane zip files have no duplicates, and the DotNetZip library
cannot create zip files with duplicate entries. If an application attempts
to call with a name that duplicates one
already used within the archive, the library will throw an Exception.
This property allows the application to specify whether the
ZipOutputStream instance considers ordinal case when checking for
uniqueness of zip entries.
Indicates whether to encode entry filenames and entry comments using
Unicode (UTF-8).
The
PKWare zip specification provides for encoding file names and file
comments in either the IBM437 code page, or in UTF-8. This flag selects
the encoding according to that specification. By default, this flag is
false, and filenames and comments are encoded into the zip file in the
IBM437 codepage. Setting this flag to true will specify that filenames
and comments that cannot be encoded with IBM437 will be encoded with
UTF-8.
Zip files created with strict adherence to the PKWare specification with
respect to UTF-8 encoding can contain entries with filenames containing
any combination of Unicode characters, including the full range of
characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other
alphabets. However, because at this time, the UTF-8 portion of the PKWare
specification is not broadly supported by other zip libraries and
utilities, such zip files may not be readable by your favorite zip tool or
archiver. In other words, interoperability will decrease if you set this
flag to true.
In particular, Zip files created with strict adherence to the PKWare
specification with respect to UTF-8 encoding will not work well with
Explorer in Windows XP or Windows Vista, because Windows compressed
folders, as far as I know, do not support UTF-8 in zip files. Vista can
read the zip files, but shows the filenames incorrectly. Unpacking from
Windows Vista Explorer will result in filenames that have rubbish
characters in place of the high-order UTF-8 bytes.
Also, zip files that use UTF-8 encoding will not work well with Java
applications that use the java.util.zip classes, as of v5.0 of the Java
runtime. The Java runtime does not correctly implement the PKWare
specification in this regard.
As a result, we have the unfortunate situation that "correct" behavior by
the DotNetZip library with regard to Unicode encoding of filenames during
zip creation will result in zip files that are readable by strictly
compliant and current tools (for example the most recent release of the
commercial WinZip tool); but these zip files will not be readable by
various other tools or libraries, including Windows Explorer.
The DotNetZip library can read and write zip files with UTF8-encoded
entries, according to the PKware spec. If you use DotNetZip for both
creating and reading the zip file, and you use UTF-8, there will be no
loss of information in the filenames. For example, using a self-extractor
created by this library will allow you to unpack files correctly with no
loss of information in the filenames.
If you do not set this flag, it will remain false. If this flag is false,
the ZipOutputStream will encode all filenames and comments using
the IBM437 codepage. This can cause "loss of information" on some
filenames, but the resulting zipfile will be more interoperable with other
utilities. As an example of the loss of information, diacritics can be
lost. The o-tilde character will be down-coded to plain o. The c with a
cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c.
Likewise, the O-stroke character (Unicode 248), used in Danish and
Norwegian, will be down-coded to plain o. Chinese characters cannot be
represented in codepage IBM437; when using the default encoding, Chinese
characters in filenames will be represented as ?. These are all examples
of "information loss".
The loss of information associated to the use of the IBM437 encoding is
inconvenient, and can also lead to runtime errors. For example, using
IBM437, any sequence of 4 Chinese characters will be encoded as ????. If
your application creates a ZipOutputStream, does not set the
encoding, then adds two files, each with names of four Chinese characters
each, this will result in a duplicate filename exception. In the case
where you add a single file with a name containing four Chinese
characters, the zipfile will save properly, but extracting that file
later, with any zip tool, will result in an error, because the question
mark is not legal for use within filenames on Windows. These are just a
few examples of the problems associated to loss of information.
This flag is independent of the encoding of the content within the entries
in the zip file. Think of the zip file as a container - it supports an
encoding. Within the container are other "containers" - the file entries
themselves. The encoding within those entries is independent of the
encoding of the zip archive container for those entries.
Rather than specify the encoding in a binary fashion using this flag, an
application can specify an arbitrary encoding via the property. Setting the encoding
explicitly when creating zip archives will result in non-compliant zip
files that, curiously, are fairly interoperable. The challenge is, the
PKWare specification does not provide for a way to specify that an entry
in a zip archive uses a code page that is neither IBM437 nor UTF-8.
Therefore if you set the encoding explicitly when creating a zip archive,
you must take care upon reading the zip archive to use the same code page.
If you get it wrong, the behavior is undefined and may result in incorrect
filenames, exceptions, stomach upset, hair loss, and acne.
The text encoding to use when emitting entries into the zip archive, for
those entries whose filenames or comments cannot be encoded with the
default (IBM437) encoding.
In its
zip specification, PKWare describes two options for encoding
filenames and comments: using IBM437 or UTF-8. But, some archiving tools
or libraries do not follow the specification, and instead encode
characters using the system default code page. For example, WinRAR when
run on a machine in Shanghai may encode filenames with the Big-5 Chinese
(950) code page. This behavior is contrary to the Zip specification, but
it occurs anyway.
When using DotNetZip to write zip archives that will be read by one of
these other archivers, set this property to specify the code page to use
when encoding the and for each ZipEntry in the zip file, for
values that cannot be encoded with the default codepage for zip files,
IBM437. This is why this property is "provisional". In all cases, IBM437
is used where possible, in other words, where no loss of data would
result. It is possible, therefore, to have a given entry with a
Comment encoded in IBM437 and a FileName encoded with the
specified "provisional" codepage.
Be aware that a zip file created after you've explicitly set the
ProvisionalAlternateEncoding property to a value other than
IBM437 may not be compliant to the PKWare specification, and may not be
readable by compliant archivers. On the other hand, many (most?)
archivers are non-compliant and can read zip files created in arbitrary
code pages. The trick is to use or specify the proper codepage when
reading the zip.
When creating a zip archive using this library, it is possible to change
the value of ProvisionalAlternateEncoding between each entry you
add, and between adding entries and the call to Close(). Don't do
this. It will likely result in a zipfile that is not readable. For best
interoperability, either leave ProvisionalAlternateEncoding
alone, or specify it only once, before adding any entries to the
ZipOutputStream instance. There is one exception to this
recommendation, described later.
When using an arbitrary, non-UTF8 code page for encoding, there is no
standard way for the creator application - whether DotNetZip, WinZip,
WinRar, or something else - to formally specify in the zip file which
codepage has been used for the entries. As a result, readers of zip files
are not able to inspect the zip file and determine the codepage that was
used for the entries contained within it. It is left to the application
or user to determine the necessary codepage when reading zip files encoded
this way. If you use an incorrect codepage when reading a zipfile, you
will get entries with filenames that are incorrect, and the incorrect
filenames may even contain characters that are not legal for use within
filenames in Windows. Extracting entries with illegal characters in the
filenames will lead to exceptions. It's too bad, but this is just the way
things are with code pages in zip files. Caveat Emptor.
One possible approach for specifying the code page for a given zip file is
to describe the code page in a human-readable form in the Zip comment. For
example, the comment may read "Entries in this archive are encoded in the
Big5 code page". For maximum interoperability, the zip comment in this
case should be encoded in the default, IBM437 code page. In this case,
the zip comment is encoded using a different page than the filenames. To
do this, Specify ProvisionalAlternateEncoding to your desired
region-specific code page, once before adding any entries, and then set
the property and reset
ProvisionalAlternateEncoding to IBM437 before calling Close().
A Text Encoding to use when encoding the filenames and comments for
all the ZipEntry items, during a ZipFile.Save() operation.
Whether the encoding specified here is used during the save depends
on .
A flag that tells if and when this instance should apply
AlternateEncoding to encode the filenames and comments associated to
of ZipEntry objects contained within this instance.
The default text encoding used in zip archives. It is numeric 437, also
known as IBM437.
The size threshold for an entry, above which a parallel deflate is used.
DotNetZip will use multiple threads to compress any ZipEntry, when
the CompressionMethod is Deflate, and if the entry is
larger than the given size. Zero means "always use parallel
deflate", while -1 means "never use parallel deflate".
If the entry size cannot be known before compression, as with any entry
added via a ZipOutputStream, then Parallel deflate will never be
performed, unless the value of this property is zero.
A parallel deflate operations will speed up the compression of
large files, on computers with multiple CPUs or multiple CPU
cores. For files above 1mb, on a dual core or dual-cpu (2p)
machine, the time required to compress the file can be 70% of the
single-threaded deflate. For very large files on 4p machines the
compression can be done in 30% of the normal time. The downside
is that parallel deflate consumes extra memory during the deflate,
and the deflation is slightly less effective.
Parallel deflate tends to not be as effective as single-threaded deflate
because the original data stream is split into multiple independent
buffers, each of which is compressed in parallel. But because they are
treated independently, there is no opportunity to share compression
dictionaries, and additional framing bytes must be added to the output
stream. For that reason, a deflated stream may be slightly larger when
compressed using parallel deflate, as compared to a traditional
single-threaded deflate. For files of about 512k, the increase over the
normal deflate is as much as 5% of the total compressed size. For larger
files, the difference can be as small as 0.1%.
Multi-threaded compression does not give as much an advantage when using
Encryption. This is primarily because encryption tends to slow down
the entire pipeline. Also, multi-threaded compression gives less of an
advantage when using lower compression levels, for example . You may have to perform
some tests to determine the best approach for your situation.
The default value for this property is -1, which means parallel
compression will not be performed unless you set it to zero.
The maximum number of buffer pairs to use when performing
parallel compression.
This property sets an upper limit on the number of memory
buffer pairs to create when performing parallel
compression. The implementation of the parallel
compression stream allocates multiple buffers to
facilitate parallel compression. As each buffer fills up,
the stream uses
ThreadPool.QueueUserWorkItem() to compress those
buffers in a background threadpool thread. After a buffer
is compressed, it is re-ordered and written to the output
stream.
A higher number of buffer pairs enables a higher degree of
parallelism, which tends to increase the speed of compression on
multi-cpu computers. On the other hand, a higher number of buffer
pairs also implies a larger memory consumption, more active worker
threads, and a higher cpu utilization for any compression. This
property enables the application to limit its memory consumption and
CPU utilization behavior depending on requirements.
For each compression "task" that occurs in parallel, there are 2
buffers allocated: one for input and one for output. This property
sets a limit for the number of pairs. The total amount of storage
space allocated for buffering will then be (N*S*2), where N is the
number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer
pairs per CPU core, so if your machine has 4 cores, and you retain
the default buffer size of 128k, then the
ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
memory in total, or 4mb, in blocks of 128kb. If you then set this
property to 8, then the number will be 8 * 2 * 128kb of buffer
memory, or 2mb.
CPU utilization will also go up with additional buffers, because a
larger number of buffer pairs allows a larger number of background
threads to compress in parallel. If you find that parallel
compression is consuming too much memory or CPU, you can adjust this
value downward.
The default value is 16. Different values may deliver better or
worse results, depending on your priorities and the dynamic
performance characteristics of your storage and compute resources.
This property is not the number of buffer pairs to use; it is an
upper limit. An illustration: Suppose you have an application that
uses the default value of this property (which is 16), and it runs
on a machine with 2 CPU cores. In that case, DotNetZip will allocate
4 buffer pairs per CPU core, for a total of 8 pairs. The upper
limit specified by this property has no effect.
The application can set this value at any time, but it is
effective only if set before calling
ZipOutputStream.Write() for the first time.
Returns true if an entry by the given name has already been written
to the ZipOutputStream.
The name of the entry to scan for.
true if an entry by the given name has already been written.
Write the data from the buffer to the stream.
As the application writes data into this stream, the data may be
compressed and encrypted before being written out to the underlying
stream, depending on the settings of the
and the properties.
The buffer holding data to write to the stream.
the offset within that data array to find the first byte to write.
the number of bytes to write.
Specify the name of the next entry that will be written to the zip file.
Call this method just before calling , to
specify the name of the entry that the next set of bytes written to
the ZipOutputStream belongs to. All subsequent calls to Write,
until the next call to PutNextEntry,
will be inserted into the named entry in the zip file.
If the used in PutNextEntry() ends in
a slash, then the entry added is marked as a directory. Because directory
entries do not contain data, a call to Write(), before an
intervening additional call to PutNextEntry(), will throw an
exception.
If you don't call Write() between two calls to
PutNextEntry(), the first entry is inserted into the zip file as a
file of zero size. This may be what you want.
Because PutNextEntry() closes out the prior entry, if any, this
method may throw if there is a problem with the prior entry.
This method returns the ZipEntry. You can modify public properties
on the ZipEntry, such as , , and so on, until the first call to
ZipOutputStream.Write(), or until the next call to
PutNextEntry(). If you modify the ZipEntry after
having called Write(), you may get a runtime exception, or you may
silently get an invalid zip archive.
This example shows how to create a zip file, using the
ZipOutputStream class.
private void Zipup()
{
using (FileStream fs raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite ))
{
using (var output= new ZipOutputStream(fs))
{
output.Password = "VerySecret!";
output.Encryption = EncryptionAlgorithm.WinZipAes256;
output.PutNextEntry("entry1.txt");
byte[] buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #1.");
output.Write(buffer,0,buffer.Length);
output.PutNextEntry("entry2.txt"); // this will be zero length
output.PutNextEntry("entry3.txt");
buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #3.");
output.Write(buffer,0,buffer.Length);
}
}
}
The name of the entry to be added, including any path to be used
within the zip file.
The ZipEntry created.
Dispose the stream
This method writes the Zip Central directory, then closes the stream. The
application must call Dispose() (or Close) in order to produce a valid zip file.
Typically the application will call Dispose() implicitly, via a using
statement in C#, or a Using statement in VB.
set this to true, always.
Always returns false.
Always returns false.
Always returns true.
Always returns a NotSupportedException.
Setting this property always returns a NotSupportedException. Getting it
returns the value of the Position on the underlying stream.
This is a no-op.
This method always throws a NotSupportedException.
ignored
ignored
ignored
nothing
This method always throws a NotSupportedException.
ignored
ignored
nothing
This method always throws a NotSupportedException.
ignored
Sort-of like a factory method, ForUpdate is used only when
the application needs to update the zip entry metadata for
a segmented zip file, when the starting segment is earlier
than the ending segment, for a particular entry.
The update is always contiguous, never rolls over. As a
result, this method doesn't need to return a ZSS; it can
simply return a FileStream. That's why it's "sort of"
like a Factory method.
Caller must Close/Dispose the stream object returned by
this method.
Name of the filesystem file corresponding to the current segment.
The name is not always the name currently being used in the
filesystem. When rwMode is RwMode.Write, the filesystem file has a
temporary name until the stream is closed or until the next segment is
started.
Read from the stream
the buffer to read
the offset at which to start
the number of bytes to read
the number of bytes actually read
Write to the stream.
the buffer from which to write
the offset at which to start writing
the number of bytes to write
Computes a CRC-32. The CRC-32 algorithm is parameterized - you
can set the polynomial and enable or disable bit
reversal. This can be used for GZIP, BZip2, or ZIP.
This type is used internally by DotNetZip; it is generally not used
directly by applications wishing to create, read, or manipulate zip
archive files.
Indicates the total number of bytes applied to the CRC.
Indicates the current CRC for all blocks slurped in.
Returns the CRC32 for the specified stream.
The stream over which to calculate the CRC32
the CRC32 calculation
Returns the CRC32 for the specified stream, and writes the input into the
output stream.
The stream over which to calculate the CRC32
The stream into which to deflate the input
the CRC32 calculation
Get the CRC32 for the given (word,byte) combo. This is a
computation defined by PKzip for PKZIP 2.0 (weak) encryption.
The word to start with.
The byte to combine it with.
The CRC-ized result.
Update the value for the running CRC32 using the given block of bytes.
This is useful when using the CRC32() class in a Stream.
block of bytes to slurp
starting point in the block
how many bytes within the block to slurp
Process one byte in the CRC.
the byte to include into the CRC .
Process a run of N identical bytes into the CRC.
This method serves as an optimization for updating the CRC when a
run of identical bytes is found. Rather than passing in a buffer of
length n, containing all identical bytes b, this method accepts the
byte value and the length of the (virtual) buffer - the length of
the run.
the byte to include into the CRC.
the number of times that byte should be repeated.
Combines the given CRC32 value with the current running total.
This is useful when using a divide-and-conquer approach to
calculating a CRC. Multiple threads can each calculate a
CRC32 on a segment of the data, and then combine the
individual CRC32 values at the end.
the crc value to be combined with this one
the length of data the CRC value was calculated on
Create an instance of the CRC32 class using the default settings: no
bit reversal, and a polynomial of 0xEDB88320.
Create an instance of the CRC32 class, specifying whether to reverse
data bits or not.
specify true if the instance should reverse data bits.
In the CRC-32 used by BZip2, the bits are reversed. Therefore if you
want a CRC32 with compatibility with BZip2, you should pass true
here. In the CRC-32 used by GZIP and PKZIP, the bits are not
reversed; Therefore if you want a CRC32 with compatibility with
those, you should pass false.
Create an instance of the CRC32 class, specifying the polynomial and
whether to reverse data bits or not.
The polynomial to use for the CRC, expressed in the reversed (LSB)
format: the highest ordered bit in the polynomial value is the
coefficient of the 0th power; the second-highest order bit is the
coefficient of the 1 power, and so on. Expressed this way, the
polynomial for the CRC-32C used in IEEE 802.3, is 0xEDB88320.
specify true if the instance should reverse data bits.
In the CRC-32 used by BZip2, the bits are reversed. Therefore if you
want a CRC32 with compatibility with BZip2, you should pass true
here for the reverseBits parameter. In the CRC-32 used by
GZIP and PKZIP, the bits are not reversed; Therefore if you want a
CRC32 with compatibility with those, you should pass false for the
reverseBits parameter.
Reset the CRC-32 class - clear the CRC "remainder register."
Use this when employing a single instance of this class to compute
multiple, distinct CRCs on multiple, distinct data blocks.
A Stream that calculates a CRC32 (a checksum) on all bytes read,
or on all bytes written.
This class can be used to verify the CRC of a ZipEntry when
reading from a stream, or to calculate a CRC when writing to a
stream. The stream should be used to either read, or write, but
not both. If you intermix reads and writes, the results are not
defined.
This class is intended primarily for use internally by the
DotNetZip library.
The default constructor.
Instances returned from this constructor will leave the underlying
stream open upon Close(). The stream uses the default CRC32
algorithm, which implies a polynomial of 0xEDB88320.
The underlying stream
The constructor allows the caller to specify how to handle the
underlying stream at close.
The stream uses the default CRC32 algorithm, which implies a
polynomial of 0xEDB88320.
The underlying stream
true to leave the underlying stream
open upon close of the CrcCalculatorStream; false otherwise.
A constructor allowing the specification of the length of the stream
to read.
The stream uses the default CRC32 algorithm, which implies a
polynomial of 0xEDB88320.
Instances returned from this constructor will leave the underlying
stream open upon Close().
The underlying stream
The length of the stream to slurp
A constructor allowing the specification of the length of the stream
to read, as well as whether to keep the underlying stream open upon
Close().
The stream uses the default CRC32 algorithm, which implies a
polynomial of 0xEDB88320.
The underlying stream
The length of the stream to slurp
true to leave the underlying stream
open upon close of the CrcCalculatorStream; false otherwise.
A constructor allowing the specification of the length of the stream
to read, as well as whether to keep the underlying stream open upon
Close(), and the CRC32 instance to use.
The stream uses the specified CRC32 instance, which allows the
application to specify how the CRC gets calculated.
The underlying stream
The length of the stream to slurp
true to leave the underlying stream
open upon close of the CrcCalculatorStream; false otherwise.
the CRC32 instance to use to calculate the CRC32
Gets the total number of bytes run through the CRC32 calculator.
This is either the total number of bytes read, or the total number of
bytes written, depending on the direction of this stream.
Provides the current CRC for all blocks slurped in.
The running total of the CRC is kept as data is written or read
through the stream. read this property after all reads or writes to
get an accurate CRC for the entire stream.
Indicates whether the underlying stream will be left open when the
CrcCalculatorStream is Closed.
Read from the stream
the buffer to read
the offset at which to start
the number of bytes to read
the number of bytes actually read
Write to the stream.
the buffer from which to write
the offset at which to start writing
the number of bytes to write
Indicates whether the stream supports reading.
Indicates whether the stream supports seeking.
Always returns false.
Indicates whether the stream supports writing.
Flush the stream.
Returns the length of the underlying stream.
The getter for this property returns the total bytes read.
If you use the setter, it will throw
.
Seeking is not supported on this stream. This method always throws
N/A
N/A
N/A
This method always throws
N/A
Enumerates the options for a logical conjunction. This enum is intended for use
internally by the FileSelector class.
FileSelector encapsulates logic that selects files from a source - a zip file
or the filesystem - based on a set of criteria. This class is used internally
by the DotNetZip library, in particular for the AddSelectedFiles() methods.
This class can also be used independently of the zip capability in DotNetZip.
The FileSelector class is used internally by the ZipFile class for selecting
files for inclusion into the ZipFile, when the method, or one of
its overloads, is called. It's also used for the methods. Typically, an
application that creates or manipulates Zip archives will not directly
interact with the FileSelector class.
Some applications may wish to use the FileSelector class directly, to
select files from disk volumes based on a set of criteria, without creating or
querying Zip archives. The file selection criteria include: a pattern to
match the filename; the last modified, created, or last accessed time of the
file; the size of the file; and the attributes of the file.
Consult the documentation for
for more information on specifying the selection criteria.
Constructor that allows the caller to specify file selection criteria.
This constructor allows the caller to specify a set of criteria for
selection of files.
See for a description of
the syntax of the selectionCriteria string.
By default the FileSelector will traverse NTFS Reparse Points. To
change this, use FileSelector(String, bool).
The criteria for file selection.
Constructor that allows the caller to specify file selection criteria.
This constructor allows the caller to specify a set of criteria for
selection of files.
See for a description of
the syntax of the selectionCriteria string.
The criteria for file selection.
whether to traverse NTFS reparse points (junctions).
The string specifying which files to include when retrieving.
Specify the criteria in statements of 3 elements: a noun, an operator,
and a value. Consider the string "name != *.doc" . The noun is
"name". The operator is "!=", implying "Not Equal". The value is
"*.doc". That criterion, in English, says "all files with a name that
does not end in the .doc extension."
Supported nouns include "name" (or "filename") for the filename;
"atime", "mtime", and "ctime" for last access time, last modfied time,
and created time of the file, respectively; "attributes" (or "attrs")
for the file attributes; "size" (or "length") for the file length
(uncompressed); and "type" for the type of object, either a file or a
directory. The "attributes", "type", and "name" nouns all support =
and != as operators. The "size", "atime", "mtime", and "ctime" nouns
support = and !=, and >, >=, <, <= as well. The times are
taken to be expressed in local time.
Specify values for the file attributes as a string with one or more of
the characters H,R,S,A,I,L in any order, implying file attributes of
Hidden, ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint
(symbolic link) respectively.
To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as
the format. If you omit the HH:mm:ss portion, it is assumed to be
00:00:00 (midnight).
The value for a size criterion is expressed in integer quantities of
bytes, kilobytes (use k or kb after the number), megabytes (m or mb),
or gigabytes (g or gb).
The value for a name is a pattern to match against the filename,
potentially including wildcards. The pattern follows CMD.exe glob
rules: * implies one or more of any character, while ? implies one
character. If the name pattern contains any slashes, it is matched to
the entire filename, including the path; otherwise, it is matched
against only the filename without the path. This means a pattern of
"*\*.*" matches all files one directory level deep, while a pattern of
"*.*" matches all files in all directories.
To specify a name pattern that includes spaces, use single quotes
around the pattern. A pattern of "'* *.*'" will match all files that
have spaces in the filename. The full criteria string for that would
be "name = '* *.*'" .
The value for a type criterion is either F (implying a file) or D
(implying a directory).
Some examples:
criteria
Files retrieved
-
name != *.xls
any file with an extension that is not .xls
-
name = *.mp3
any file with a .mp3 extension.
-
*.mp3
(same as above) any file with a .mp3 extension.
-
attributes = A
all files whose attributes include the Archive bit.
-
attributes != H
all files whose attributes do not include the Hidden bit.
-
mtime > 2009-01-01
all files with a last modified time after January 1st, 2009.
-
ctime > 2009/01/01-03:00:00
all files with a created time after 3am (local time),
on January 1st, 2009.
-
size > 2gb
all files whose uncompressed size is greater than 2gb.
-
type = D
all directories in the filesystem.
You can combine criteria with the conjunctions AND, OR, and XOR. Using
a string like "name = *.txt AND size >= 100k" for the
selectionCriteria retrieves entries whose names end in .txt, and whose
uncompressed size is greater than or equal to 100 kilobytes.
For more complex combinations of criteria, you can use parenthesis to
group clauses in the boolean logic. Absent parenthesis, the
precedence of the criterion atoms is determined by order of
appearance. Unlike the C# language, the AND conjunction does not take
precendence over the logical OR. This is important only in strings
that contain 3 or more criterion atoms. In other words, "name = *.txt
and size > 1000 or attributes = H" implies "((name = *.txt AND size
> 1000) OR attributes = H)" while "attributes = H OR name = *.txt
and size > 1000" evaluates to "((attributes = H OR name = *.txt)
AND size > 1000)". When in doubt, use parenthesis.
Using time properties requires some extra care. If you want to
retrieve all entries that were last updated on 2009 February 14,
specify "mtime >= 2009-02-14 AND mtime < 2009-02-15". Read this
to say: all files updated after 12:00am on February 14th, until
12:00am on February 15th. You can use the same bracketing approach to
specify any time period - a year, a month, a week, and so on.
The syntax allows one special case: if you provide a string with no
spaces, it is treated as a pattern to match for the filename.
Therefore a string like "*.xls" will be equivalent to specifying "name
= *.xls". This "shorthand" notation does not work with compound
criteria.
There is no logic in this class that insures that the inclusion
criteria are internally consistent. For example, it's possible to
specify criteria that says the file must have a size of less than 100
bytes, as well as a size that is greater than 1000 bytes. Obviously
no file will ever satisfy such criteria, but this class does not check
for or detect such inconsistencies.
Thrown in the setter if the value has an invalid syntax.
Indicates whether searches will traverse NTFS reparse points, like Junctions.
Returns a string representation of the FileSelector object.
The string representation of the boolean logic statement of the file
selection criteria for this instance.
Returns the names of the files in the specified directory
that fit the selection criteria specified in the FileSelector.
This is equivalent to calling
with recurseDirectories = false.
The name of the directory over which to apply the FileSelector
criteria.
A collection of strings containing fully-qualified pathnames of files
that match the criteria specified in the FileSelector instance.
Returns the names of the files in the specified directory that fit the
selection criteria specified in the FileSelector, optionally recursing
through subdirectories.
This method applies the file selection criteria contained in the
FileSelector to the files contained in the given directory, and
returns the names of files that conform to the criteria.
The name of the directory over which to apply the FileSelector
criteria.
Whether to recurse through subdirectories when applying the file
selection criteria.
A collection of strings containing fully-qualified pathnames of files
that match the criteria specified in the FileSelector instance.
Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria.
This method applies the criteria set in the FileSelector instance (as described in
the ) to the specified ZipFile. Using this
method, for example, you can retrieve all entries from the given ZipFile that
have filenames ending in .txt.
Normally, applications would not call this method directly. This method is used
by the ZipFile class.
Using the appropriate SelectionCriteria, you can retrieve entries based on size,
time, and attributes. See for a
description of the syntax of the SelectionCriteria string.
The ZipFile from which to retrieve entries.
a collection of ZipEntry objects that conform to the criteria.
Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria.
This method applies the criteria set in the FileSelector instance (as described in
the ) to the specified ZipFile. Using this
method, for example, you can retrieve all entries from the given ZipFile that
have filenames ending in .txt.
Normally, applications would not call this method directly. This method is used
by the ZipFile class.
This overload allows the selection of ZipEntry instances from the ZipFile to be restricted
to entries contained within a particular directory in the ZipFile.
Using the appropriate SelectionCriteria, you can retrieve entries based on size,
time, and attributes. See for a
description of the syntax of the SelectionCriteria string.
The ZipFile from which to retrieve entries.
the directory in the archive from which to select entries. If null, then
all directories in the archive are used.
a collection of ZipEntry objects that conform to the criteria.
Summary description for EnumUtil.
Returns the value of the DescriptionAttribute if the specified Enum
value has one. If not, returns the ToString() representation of the
Enum value.
The Enum to get the description for
Converts the string representation of the name or numeric value of one
or more enumerated constants to an equivalent enumerated object.
Note: use the DescriptionAttribute on enum values to enable this.
The System.Type of the enumeration.
A string containing the name or value to convert.
Converts the string representation of the name or numeric value of one
or more enumerated constants to an equivalent enumerated object. A
parameter specified whether the operation is case-sensitive. Note:
use the DescriptionAttribute on enum values to enable this.
The System.Type of the enumeration.
A string containing the name or value to convert.
Whether the operation is case-sensitive or not.
A class for compressing and decompressing streams using the Deflate algorithm.
The DeflateStream is a Decorator on a . It adds DEFLATE compression or decompression to any
stream.
Using this stream, applications can compress or decompress data via stream
Read and Write operations. Either compresssion or decompression
can occur through either reading or writing. The compression format used is
DEFLATE, which is documented in IETF RFC 1951, "DEFLATE
Compressed Data Format Specification version 1.3.".
This class is similar to , except that
ZlibStream adds the RFC
1950 - ZLIB framing bytes to a compressed stream when compressing, or
expects the RFC1950 framing bytes when decompressing. The DeflateStream
does not.
Create a DeflateStream using the specified CompressionMode.
When mode is CompressionMode.Compress, the DeflateStream will use
the default compression level. The "captive" stream will be closed when
the DeflateStream is closed.
This example uses a DeflateStream to compress data from a file, and writes
the compressed data to another file.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(fileToCompress + ".deflated"))
{
using (Stream compressor = new DeflateStream(raw, CompressionMode.Compress))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(fileToCompress & ".deflated")
Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream which will be read or written.
Indicates whether the DeflateStream will compress or decompress.
Create a DeflateStream using the specified CompressionMode and the specified CompressionLevel.
When mode is CompressionMode.Decompress, the level parameter is
ignored. The "captive" stream will be closed when the DeflateStream is
closed.
This example uses a DeflateStream to compress data from a file, and writes
the compressed data to another file.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(fileToCompress + ".deflated"))
{
using (Stream compressor = new DeflateStream(raw,
CompressionMode.Compress,
CompressionLevel.BestCompression))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n= -1;
while (n != 0)
{
if (n > 0)
compressor.Write(buffer, 0, n);
n= input.Read(buffer, 0, buffer.Length);
}
}
}
}
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(fileToCompress & ".deflated")
Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream to be read or written while deflating or inflating.
Indicates whether the DeflateStream will compress or decompress.
A tuning knob to trade speed for effectiveness.
Create a DeflateStream using the specified
CompressionMode, and explicitly specify whether the
stream should be left open after Deflation or Inflation.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
memory stream that will be re-read after compression. Specify true for
the parameter to leave the stream open.
The DeflateStream will use the default compression level.
See the other overloads of this constructor for example code.
The stream which will be read or written. This is called the
"captive" stream in other places in this documentation.
Indicates whether the DeflateStream will compress or decompress.
true if the application would like the stream to
remain open after inflation/deflation.
Create a DeflateStream using the specified CompressionMode
and the specified CompressionLevel, and explicitly specify whether
the stream should be left open after Deflation or Inflation.
When mode is CompressionMode.Decompress, the level parameter is ignored.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
that will be re-read after
compression. Specify true for the parameter
to leave the stream open.
This example shows how to use a DeflateStream to compress data from
a file, and store the compressed data into another file.
using (var output = System.IO.File.Create(fileToCompress + ".deflated"))
{
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (Stream compressor = new DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n= -1;
while (n != 0)
{
if (n > 0)
compressor.Write(buffer, 0, n);
n= input.Read(buffer, 0, buffer.Length);
}
}
}
// can write additional data to the output stream here
}
Using output As FileStream = File.Create(fileToCompress & ".deflated")
Using input As Stream = File.OpenRead(fileToCompress)
Using compressor As Stream = New DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
' can write additional data to the output stream here.
End Using
The stream which will be read or written.
Indicates whether the DeflateStream will compress or decompress.
true if the application would like the stream to remain open after inflation/deflation.
A tuning knob to trade speed for effectiveness.
This property sets the flush behavior on the stream.
See the ZLIB documentation for the meaning of the flush behavior.
The size of the working buffer for the compression codec.
The working buffer is used for all stream operations. The default size is
1024 bytes. The minimum size is 128 bytes. You may get better performance
with a larger buffer. Then again, you might not. You would have to test
it.
Set this before the first call to Read() or Write() on the
stream. If you try to set it afterwards, it will throw.
The ZLIB strategy to be used during compression.
By tweaking this parameter, you may be able to optimize the compression for
data with particular characteristics.
Returns the total number of bytes input so far.
Returns the total number of bytes output so far.
Dispose the stream.
This may or may not result in a Close() call on the captive
stream. See the constructors that have a leaveOpen parameter
for more information.
Application code won't call this code directly. This method may be
invoked in two distinct scenarios. If disposing == true, the method
has been called directly or indirectly by a user's code, for example
via the public Dispose() method. In this case, both managed and
unmanaged resources can be referenced and disposed. If disposing ==
false, the method has been called by the runtime from inside the
object finalizer and this method should not reference other objects;
in that case only unmanaged resources must be referenced or
disposed.
true if the Dispose method was invoked by user code.
Indicates whether the stream can be read.
The return value depends on whether the captive stream supports reading.
Indicates whether the stream supports Seek operations.
Always returns false.
Indicates whether the stream can be written.
The return value depends on whether the captive stream supports writing.
Flush the stream.
Reading this property always throws a .
The position of the stream pointer.
Setting this property always throws a . Reading will return the total bytes
written out, if used in writing, or the total bytes read in, if used in
reading. The count may refer to compressed bytes or uncompressed bytes,
depending on how you've used the stream.
Read data from the stream.
If you wish to use the DeflateStream to compress data while
reading, you can create a DeflateStream with
CompressionMode.Compress, providing an uncompressed data stream.
Then call Read() on that DeflateStream, and the data read will be
compressed as you read. If you wish to use the DeflateStream to
decompress data while reading, you can create a DeflateStream with
CompressionMode.Decompress, providing a readable compressed data
stream. Then call Read() on that DeflateStream, and the data read
will be decompressed as you read.
A DeflateStream can be used for Read() or Write(), but not both.
The buffer into which the read data should be placed.
the offset within that data array to put the first byte read.
the number of bytes to read.
the number of bytes actually read
Calling this method always throws a .
this is irrelevant, since it will always throw!
this is irrelevant, since it will always throw!
irrelevant!
Calling this method always throws a .
this is irrelevant, since it will always throw!
Write data to the stream.
If you wish to use the DeflateStream to compress data while
writing, you can create a DeflateStream with
CompressionMode.Compress, and a writable output stream. Then call
Write() on that DeflateStream, providing uncompressed data
as input. The data sent to the output stream will be the compressed form
of the data written. If you wish to use the DeflateStream to
decompress data while writing, you can create a DeflateStream with
CompressionMode.Decompress, and a writable output stream. Then
call Write() on that stream, providing previously compressed
data. The data sent to the output stream will be the decompressed form of
the data written.
A DeflateStream can be used for Read() or Write(),
but not both.
The buffer holding data to write to the stream.
the offset within that data array to find the first byte to write.
the number of bytes to write.
Compress a string into a byte array using DEFLATE (RFC 1951).
Uncompress it with .
DeflateStream.UncompressString(byte[])
DeflateStream.CompressBuffer(byte[])
GZipStream.CompressString(string)
ZlibStream.CompressString(string)
A string to compress. The string will first be encoded
using UTF8, then compressed.
The string in compressed form
Compress a byte array into a new byte array using DEFLATE.
Uncompress it with .
DeflateStream.CompressString(string)
DeflateStream.UncompressBuffer(byte[])
GZipStream.CompressBuffer(byte[])
ZlibStream.CompressBuffer(byte[])
A buffer to compress.
The data in compressed form
Uncompress a DEFLATE'd byte array into a single string.
DeflateStream.CompressString(String)
DeflateStream.UncompressBuffer(byte[])
GZipStream.UncompressString(byte[])
ZlibStream.UncompressString(byte[])
A buffer containing DEFLATE-compressed data.
The uncompressed string
Uncompress a DEFLATE'd byte array into a byte array.
DeflateStream.CompressBuffer(byte[])
DeflateStream.UncompressString(byte[])
GZipStream.UncompressBuffer(byte[])
ZlibStream.UncompressBuffer(byte[])
A buffer containing data that has been compressed with DEFLATE.
The data in uncompressed form
A class for compressing and decompressing GZIP streams.
The GZipStream is a Decorator on a
. It adds GZIP compression or decompression to any
stream.
Like the System.IO.Compression.GZipStream in the .NET Base Class Library, the
Ionic.Zlib.GZipStream can compress while writing, or decompress while
reading, but not vice versa. The compression method used is GZIP, which is
documented in IETF RFC
1952, "GZIP file format specification version 4.3".
A GZipStream can be used to decompress data (through Read()) or
to compress data (through Write()), but not both.
If you wish to use the GZipStream to compress data, you must wrap it
around a write-able stream. As you call Write() on the GZipStream, the
data will be compressed into the GZIP format. If you want to decompress data,
you must wrap the GZipStream around a readable stream that contains an
IETF RFC 1952-compliant stream. The data will be decompressed as you call
Read() on the GZipStream.
Though the GZIP format allows data from multiple files to be concatenated
together, this stream handles only a single segment of GZIP format, typically
representing a single file.
This class is similar to and .
ZlibStream handles RFC1950-compliant streams.
handles RFC1951-compliant streams. This class handles RFC1952-compliant streams.
The comment on the GZIP stream.
The GZIP format allows for each file to optionally have an associated
comment stored with the file. The comment is encoded with the ISO-8859-1
code page. To include a comment in a GZIP stream you create, set this
property before calling Write() for the first time on the
GZipStream.
When using GZipStream to decompress, you can retrieve this property
after the first call to Read(). If no comment has been set in the
GZIP bytestream, the Comment property will return null
(Nothing in VB).
The FileName for the GZIP stream.
The GZIP format optionally allows each file to have an associated
filename. When compressing data (through Write()), set this
FileName before calling Write() the first time on the GZipStream.
The actual filename is encoded into the GZIP bytestream with the
ISO-8859-1 code page, according to RFC 1952. It is the application's
responsibility to insure that the FileName can be encoded and decoded
correctly with this code page.
When decompressing (through Read()), you can retrieve this value
any time after the first Read(). In the case where there was no filename
encoded into the GZIP bytestream, the property will return null (Nothing
in VB).
The last modified time for the GZIP stream.
GZIP allows the storage of a last modified time with each GZIP entry.
When compressing data, you can set this before the first call to
Write(). When decompressing, you can retrieve this value any time
after the first call to Read().
The CRC on the GZIP stream.
This is used for internal error checking. You probably don't need to look at this property.
Create a GZipStream using the specified CompressionMode.
When mode is CompressionMode.Compress, the GZipStream will use the
default compression level.
As noted in the class documentation, the CompressionMode (Compress
or Decompress) also establishes the "direction" of the stream. A
GZipStream with CompressionMode.Compress works only through
Write(). A GZipStream with
CompressionMode.Decompress works only through Read().
This example shows how to use a GZipStream to compress data.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(outputFile))
{
using (Stream compressor = new GZipStream(raw, CompressionMode.Compress))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Dim outputFile As String = (fileToCompress & ".compressed")
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(outputFile)
Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
This example shows how to use a GZipStream to uncompress a file.
private void GunZipFile(string filename)
{
if (!filename.EndsWith(".gz))
throw new ArgumentException("filename");
var DecompressedFile = filename.Substring(0,filename.Length-3);
byte[] working = new byte[WORKING_BUFFER_SIZE];
int n= 1;
using (System.IO.Stream input = System.IO.File.OpenRead(filename))
{
using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true))
{
using (var output = System.IO.File.Create(DecompressedFile))
{
while (n !=0)
{
n= decompressor.Read(working, 0, working.Length);
if (n > 0)
{
output.Write(working, 0, n);
}
}
}
}
}
}
Private Sub GunZipFile(ByVal filename as String)
If Not (filename.EndsWith(".gz)) Then
Throw New ArgumentException("filename")
End If
Dim DecompressedFile as String = filename.Substring(0,filename.Length-3)
Dim working(WORKING_BUFFER_SIZE) as Byte
Dim n As Integer = 1
Using input As Stream = File.OpenRead(filename)
Using decompressor As Stream = new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, True)
Using output As Stream = File.Create(UncompressedFile)
Do
n= decompressor.Read(working, 0, working.Length)
If n > 0 Then
output.Write(working, 0, n)
End IF
Loop While (n > 0)
End Using
End Using
End Using
End Sub
The stream which will be read or written.
Indicates whether the GZipStream will compress or decompress.
Create a GZipStream using the specified CompressionMode and
the specified CompressionLevel.
The CompressionMode (Compress or Decompress) also establishes the
"direction" of the stream. A GZipStream with
CompressionMode.Compress works only through Write(). A
GZipStream with CompressionMode.Decompress works only
through Read().
This example shows how to use a GZipStream to compress a file into a .gz file.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(fileToCompress + ".gz"))
{
using (Stream compressor = new GZipStream(raw,
CompressionMode.Compress,
CompressionLevel.BestCompression))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(fileToCompress & ".gz")
Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream to be read or written while deflating or inflating.
Indicates whether the GZipStream will compress or decompress.
A tuning knob to trade speed for effectiveness.
Create a GZipStream using the specified CompressionMode, and
explicitly specify whether the stream should be left open after Deflation
or Inflation.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
memory stream that will be re-read after compressed data has been written
to it. Specify true for the parameter to leave
the stream open.
The (Compress or Decompress) also
establishes the "direction" of the stream. A GZipStream with
CompressionMode.Compress works only through Write(). A GZipStream
with CompressionMode.Decompress works only through Read().
The GZipStream will use the default compression level. If you want
to specify the compression level, see .
See the other overloads of this constructor for example code.
The stream which will be read or written. This is called the "captive"
stream in other places in this documentation.
Indicates whether the GZipStream will compress or decompress.
true if the application would like the base stream to remain open after
inflation/deflation.
Create a GZipStream using the specified CompressionMode and the
specified CompressionLevel, and explicitly specify whether the
stream should be left open after Deflation or Inflation.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
memory stream that will be re-read after compressed data has been written
to it. Specify true for the parameter to
leave the stream open.
As noted in the class documentation, the CompressionMode (Compress
or Decompress) also establishes the "direction" of the stream. A
GZipStream with CompressionMode.Compress works only through
Write(). A GZipStream with CompressionMode.Decompress works only
through Read().
This example shows how to use a GZipStream to compress data.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(outputFile))
{
using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Dim outputFile As String = (fileToCompress & ".compressed")
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(outputFile)
Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream which will be read or written.
Indicates whether the GZipStream will compress or decompress.
true if the application would like the stream to remain open after inflation/deflation.
A tuning knob to trade speed for effectiveness.
This property sets the flush behavior on the stream.
The size of the working buffer for the compression codec.
The working buffer is used for all stream operations. The default size is
1024 bytes. The minimum size is 128 bytes. You may get better performance
with a larger buffer. Then again, you might not. You would have to test
it.
Set this before the first call to Read() or Write() on the
stream. If you try to set it afterwards, it will throw.
Returns the total number of bytes input so far.
Returns the total number of bytes output so far.
Dispose the stream.
This may or may not result in a Close() call on the captive
stream. See the constructors that have a leaveOpen parameter
for more information.
This method may be invoked in two distinct scenarios. If disposing
== true, the method has been called directly or indirectly by a
user's code, for example via the public Dispose() method. In this
case, both managed and unmanaged resources can be referenced and
disposed. If disposing == false, the method has been called by the
runtime from inside the object finalizer and this method should not
reference other objects; in that case only unmanaged resources must
be referenced or disposed.
indicates whether the Dispose method was invoked by user code.
Indicates whether the stream can be read.
The return value depends on whether the captive stream supports reading.
Indicates whether the stream supports Seek operations.
Always returns false.
Indicates whether the stream can be written.
The return value depends on whether the captive stream supports writing.
Flush the stream.
Reading this property always throws a .
The position of the stream pointer.
Setting this property always throws a . Reading will return the total bytes
written out, if used in writing, or the total bytes read in, if used in
reading. The count may refer to compressed bytes or uncompressed bytes,
depending on how you've used the stream.
Read and decompress data from the source stream.
With a GZipStream, decompression is done through reading.
byte[] working = new byte[WORKING_BUFFER_SIZE];
using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile))
{
using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true))
{
using (var output = System.IO.File.Create(_DecompressedFile))
{
int n;
while ((n= decompressor.Read(working, 0, working.Length)) !=0)
{
output.Write(working, 0, n);
}
}
}
}
The buffer into which the decompressed data should be placed.
the offset within that data array to put the first byte read.
the number of bytes to read.
the number of bytes actually read
Calling this method always throws a .
irrelevant; it will always throw!
irrelevant; it will always throw!
irrelevant!
Calling this method always throws a .
irrelevant; this method will always throw!
Write data to the stream.
If you wish to use the GZipStream to compress data while writing,
you can create a GZipStream with CompressionMode.Compress, and a
writable output stream. Then call Write() on that GZipStream,
providing uncompressed data as input. The data sent to the output stream
will be the compressed form of the data written.
A GZipStream can be used for Read() or Write(), but not
both. Writing implies compression. Reading implies decompression.
The buffer holding data to write to the stream.
the offset within that data array to find the first byte to write.
the number of bytes to write.
Compress a string into a byte array using GZip.
Uncompress it with .
A string to compress. The string will first be encoded
using UTF8, then compressed.
The string in compressed form
Compress a byte array into a new byte array using GZip.
Uncompress it with .
A buffer to compress.
The data in compressed form
Uncompress a GZip'ed byte array into a single string.
A buffer containing GZIP-compressed data.
The uncompressed string
Uncompress a GZip'ed byte array into a byte array.
A buffer containing data that has been compressed with GZip.
The data in uncompressed form
A class for compressing streams using the
Deflate algorithm with multiple threads.
This class performs DEFLATE compression through writing. For
more information on the Deflate algorithm, see IETF RFC 1951,
"DEFLATE Compressed Data Format Specification version 1.3."
This class is similar to , except
that this class is for compression only, and this implementation uses an
approach that employs multiple worker threads to perform the DEFLATE. On
a multi-cpu or multi-core computer, the performance of this class can be
significantly higher than the single-threaded DeflateStream, particularly
for larger streams. How large? Anything over 10mb is a good candidate
for parallel compression.
The tradeoff is that this class uses more memory and more CPU than the
vanilla DeflateStream, and also is less efficient as a compressor. For
large files the size of the compressed data stream can be less than 1%
larger than the size of a compressed data stream from the vanialla
DeflateStream. For smaller files the difference can be larger. The
difference will also be larger if you set the BufferSize to be lower than
the default value. Your mileage may vary. Finally, for small files, the
ParallelDeflateOutputStream can be much slower than the vanilla
DeflateStream, because of the overhead associated to using the thread
pool.
Create a ParallelDeflateOutputStream.
This stream compresses data written into it via the DEFLATE
algorithm (see RFC 1951), and writes out the compressed byte stream.
The instance will use the default compression level, the default
buffer sizes and the default number of threads and buffers per
thread.
This class is similar to ,
except that this implementation uses an approach that employs
multiple worker threads to perform the DEFLATE. On a multi-cpu or
multi-core computer, the performance of this class can be
significantly higher than the single-threaded DeflateStream,
particularly for larger streams. How large? Anything over 10mb is
a good candidate for parallel compression.
This example shows how to use a ParallelDeflateOutputStream to compress
data. It reads a file, compresses it, and writes the compressed data to
a second, output file.
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n= -1;
String outputFile = fileToCompress + ".compressed";
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(outputFile))
{
using (Stream compressor = new ParallelDeflateOutputStream(raw))
{
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Dim outputFile As String = (fileToCompress & ".compressed")
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(outputFile)
Using compressor As Stream = New ParallelDeflateOutputStream(raw)
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream to which compressed data will be written.
Create a ParallelDeflateOutputStream using the specified CompressionLevel.
See the
constructor for example code.
The stream to which compressed data will be written.
A tuning knob to trade speed for effectiveness.
Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open
when the ParallelDeflateOutputStream is closed.
See the
constructor for example code.
The stream to which compressed data will be written.
true if the application would like the stream to remain open after inflation/deflation.
Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open
when the ParallelDeflateOutputStream is closed.
See the
constructor for example code.
The stream to which compressed data will be written.
A tuning knob to trade speed for effectiveness.
true if the application would like the stream to remain open after inflation/deflation.
Create a ParallelDeflateOutputStream using the specified
CompressionLevel and CompressionStrategy, and specifying whether to
leave the captive stream open when the ParallelDeflateOutputStream is
closed.
See the
constructor for example code.
The stream to which compressed data will be written.
A tuning knob to trade speed for effectiveness.
By tweaking this parameter, you may be able to optimize the compression for
data with particular characteristics.
true if the application would like the stream to remain open after inflation/deflation.
The ZLIB strategy to be used during compression.
The maximum number of buffer pairs to use.
This property sets an upper limit on the number of memory buffer
pairs to create. The implementation of this stream allocates
multiple buffers to facilitate parallel compression. As each buffer
fills up, this stream uses
ThreadPool.QueueUserWorkItem()
to compress those buffers in a background threadpool thread. After a
buffer is compressed, it is re-ordered and written to the output
stream.
A higher number of buffer pairs enables a higher degree of
parallelism, which tends to increase the speed of compression on
multi-cpu computers. On the other hand, a higher number of buffer
pairs also implies a larger memory consumption, more active worker
threads, and a higher cpu utilization for any compression. This
property enables the application to limit its memory consumption and
CPU utilization behavior depending on requirements.
For each compression "task" that occurs in parallel, there are 2
buffers allocated: one for input and one for output. This property
sets a limit for the number of pairs. The total amount of storage
space allocated for buffering will then be (N*S*2), where N is the
number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer
pairs per CPU core, so if your machine has 4 cores, and you retain
the default buffer size of 128k, then the
ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
memory in total, or 4mb, in blocks of 128kb. If you then set this
property to 8, then the number will be 8 * 2 * 128kb of buffer
memory, or 2mb.
CPU utilization will also go up with additional buffers, because a
larger number of buffer pairs allows a larger number of background
threads to compress in parallel. If you find that parallel
compression is consuming too much memory or CPU, you can adjust this
value downward.
The default value is 16. Different values may deliver better or
worse results, depending on your priorities and the dynamic
performance characteristics of your storage and compute resources.
This property is not the number of buffer pairs to use; it is an
upper limit. An illustration: Suppose you have an application that
uses the default value of this property (which is 16), and it runs
on a machine with 2 CPU cores. In that case, DotNetZip will allocate
4 buffer pairs per CPU core, for a total of 8 pairs. The upper
limit specified by this property has no effect.
The application can set this value at any time, but it is effective
only before the first call to Write(), which is when the buffers are
allocated.
The size of the buffers used by the compressor threads.
The default buffer size is 128k. The application can set this value
at any time, but it is effective only before the first Write().
Larger buffer sizes implies larger memory consumption but allows
more efficient compression. Using smaller buffer sizes consumes less
memory but may result in less effective compression. For example,
using the default buffer size of 128k, the compression delivered is
within 1% of the compression delivered by the single-threaded . On the other hand, using a
BufferSize of 8k can result in a compressed data stream that is 5%
larger than that delivered by the single-threaded
DeflateStream. Excessively small buffer sizes can also cause
the speed of the ParallelDeflateOutputStream to drop, because of
larger thread scheduling overhead dealing with many many small
buffers.
The total amount of storage space allocated for buffering will be
(N*S*2), where N is the number of buffer pairs, and S is the size of
each buffer (this property). There are 2 buffers used by the
compressor, one for input and one for output. By default, DotNetZip
allocates 4 buffer pairs per CPU core, so if your machine has 4
cores, then the number of buffer pairs used will be 16. If you
accept the default value of this property, 128k, then the
ParallelDeflateOutputStream will use 16 * 2 * 128kb of buffer memory
in total, or 4mb, in blocks of 128kb. If you set this property to
64kb, then the number will be 16 * 2 * 64kb of buffer memory, or
2mb.
The CRC32 for the data that was written out, prior to compression.
This value is meaningful only after a call to Close().
The total number of uncompressed bytes processed by the ParallelDeflateOutputStream.
This value is meaningful only after a call to Close().
Write data to the stream.
To use the ParallelDeflateOutputStream to compress data, create a
ParallelDeflateOutputStream with CompressionMode.Compress, passing a
writable output stream. Then call Write() on that
ParallelDeflateOutputStream, providing uncompressed data as input. The
data sent to the output stream will be the compressed form of the data
written.
To decompress data, use the class.
The buffer holding data to write to the stream.
the offset within that data array to find the first byte to write.
the number of bytes to write.
Flush the stream.
Close the stream.
You must call Close on the stream to guarantee that all of the data written in has
been compressed, and the compressed data has been written out.
Dispose the object
Because ParallelDeflateOutputStream is IDisposable, the
application must call this method when finished using the instance.
This method is generally called implicitly upon exit from
a using scope in C# (Using in VB).
The Dispose method
indicates whether the Dispose method was invoked by user code.
Resets the stream for use with another stream.
Because the ParallelDeflateOutputStream is expensive to create, it
has been designed so that it can be recycled and re-used. You have
to call Close() on the stream first, then you can call Reset() on
it, to use it again on another stream.
The new output stream for this era.
ParallelDeflateOutputStream deflater = null;
foreach (var inputFile in listOfFiles)
{
string outputFile = inputFile + ".compressed";
using (System.IO.Stream input = System.IO.File.OpenRead(inputFile))
{
using (var outStream = System.IO.File.Create(outputFile))
{
if (deflater == null)
deflater = new ParallelDeflateOutputStream(outStream,
CompressionLevel.Best,
CompressionStrategy.Default,
true);
deflater.Reset(outStream);
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
deflater.Write(buffer, 0, n);
}
}
}
}
Indicates whether the stream supports Seek operations.
Always returns false.
Indicates whether the stream supports Read operations.
Always returns false.
Indicates whether the stream supports Write operations.
Returns true if the provided stream is writable.
Reading this property always throws a NotSupportedException.
Returns the current position of the output stream.
Because the output gets written by a background thread,
the value may change asynchronously. Setting this
property always throws a NotSupportedException.
This method always throws a NotSupportedException.
The buffer into which data would be read, IF THIS METHOD
ACTUALLY DID ANYTHING.
The offset within that data array at which to insert the
data that is read, IF THIS METHOD ACTUALLY DID
ANYTHING.
The number of bytes to write, IF THIS METHOD ACTUALLY DID
ANYTHING.
nothing.
This method always throws a NotSupportedException.
The offset to seek to....
IF THIS METHOD ACTUALLY DID ANYTHING.
The reference specifying how to apply the offset.... IF
THIS METHOD ACTUALLY DID ANYTHING.
nothing. It always throws.
This method always throws a NotSupportedException.
The new value for the stream length.... IF
THIS METHOD ACTUALLY DID ANYTHING.
Map from a distance to a distance code.
No side effects. _dist_code[256] and _dist_code[257] are never used.
Describes how to flush the current deflate operation.
The different FlushType values are useful when using a Deflate in a streaming application.
No flush at all.
Closes the current block, but doesn't flush it to
the output. Used internally only in hypothetical
scenarios. This was supposed to be removed by Zlib, but it is
still in use in some edge cases.
Use this during compression to specify that all pending output should be
flushed to the output buffer and the output should be aligned on a byte
boundary. You might use this in a streaming communication scenario, so that
the decompressor can get all input data available so far. When using this
with a ZlibCodec, AvailableBytesIn will be zero after the call if
enough output space has been provided before the call. Flushing will
degrade compression and so it should be used only when necessary.
Use this during compression to specify that all output should be flushed, as
with FlushType.Sync, but also, the compression state should be reset
so that decompression can restart from this point if previous compressed
data has been damaged or if random access is desired. Using
FlushType.Full too often can significantly degrade the compression.
Signals the end of the compression/decompression stream.
The compression level to be used when using a DeflateStream or ZlibStream with CompressionMode.Compress.
None means that the data will be simply stored, with no change at all.
If you are producing ZIPs for use on Mac OSX, be aware that archives produced with CompressionLevel.None
cannot be opened with the default zip reader. Use a different CompressionLevel.
Same as None.
The fastest but least effective compression.
A synonym for BestSpeed.
A little slower, but better, than level 1.
A little slower, but better, than level 2.
A little slower, but better, than level 3.
A little slower than level 4, but with better compression.
The default compression level, with a good balance of speed and compression efficiency.
A synonym for Default.
Pretty good compression!
Better compression than Level7!
The "best" compression, where best means greatest reduction in size of the input data stream.
This is also the slowest compression.
A synonym for BestCompression.
Describes options for how the compression algorithm is executed. Different strategies
work better on different sorts of data. The strategy parameter can affect the compression
ratio and the speed of compression but not the correctness of the compresssion.
The default strategy is probably the best for normal data.
The Filtered strategy is intended to be used most effectively with data produced by a
filter or predictor. By this definition, filtered data consists mostly of small
values with a somewhat random distribution. In this case, the compression algorithm
is tuned to compress them better. The effect of Filtered is to force more Huffman
coding and less string matching; it is a half-step between Default and HuffmanOnly.
Using HuffmanOnly will force the compressor to do Huffman encoding only, with no
string matching.
An enum to specify the direction of transcoding - whether to compress or decompress.
Used to specify that the stream should compress the data.
Used to specify that the stream should decompress the data.
A general purpose exception class for exceptions in the Zlib library.
The ZlibException class captures exception information generated
by the Zlib library.
This ctor collects a message attached to the exception.
the message for the exception.
Performs an unsigned bitwise right shift with the specified number
Number to operate on
Ammount of bits to shift
The resulting number from the shift operation
Reads a number of characters from the current source TextReader and writes
the data to the target array at the specified index.
The source TextReader to read from
Contains the array of characteres read from the source TextReader.
The starting index of the target array.
The maximum number of characters to read from the source TextReader.
The number of characters read. The number will be less than or equal to
count depending on the data available in the source TextReader. Returns -1
if the end of the stream is reached.
Computes an Adler-32 checksum.
The Adler checksum is similar to a CRC checksum, but faster to compute, though less
reliable. It is used in producing RFC1950 compressed streams. The Adler checksum
is a required part of the "ZLIB" standard. Applications will almost never need to
use this class directly.
Calculates the Adler32 checksum.
This is used within ZLIB. You probably don't need to use this directly.
To compute an Adler32 checksum on a byte array:
var adler = Adler.Adler32(0, null, 0, 0);
adler = Adler.Adler32(adler, buffer, index, length);
Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951).
This class compresses and decompresses data according to the Deflate algorithm
and optionally, the ZLIB format, as documented in RFC 1950 - ZLIB and RFC 1951 - DEFLATE.
The buffer from which data is taken.
An index into the InputBuffer array, indicating where to start reading.
The number of bytes available in the InputBuffer, starting at NextIn.
Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call.
The class will update this number as calls to Inflate/Deflate are made.
Total number of bytes read so far, through all calls to Inflate()/Deflate().
Buffer to store output data.
An index into the OutputBuffer array, indicating where to start writing.
The number of bytes available in the OutputBuffer, starting at NextOut.
Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call.
The class will update this number as calls to Inflate/Deflate are made.
Total number of bytes written to the output so far, through all calls to Inflate()/Deflate().
used for diagnostics, when something goes wrong!
The compression level to use in this codec. Useful only in compression mode.
The number of Window Bits to use.
This gauges the size of the sliding window, and hence the
compression effectiveness as well as memory consumption. It's best to just leave this
setting alone if you don't know what it is. The maximum value is 15 bits, which implies
a 32k window.
The compression strategy to use.
This is only effective in compression. The theory offered by ZLIB is that different
strategies could potentially produce significant differences in compression behavior
for different data sets. Unfortunately I don't have any good recommendations for how
to set it differently. When I tested changing the strategy I got minimally different
compression performance. It's best to leave this property alone if you don't have a
good feel for it. Or, you may want to produce a test harness that runs through the
different strategy options and evaluates them on different file types. If you do that,
let me know your results.
The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this.
Create a ZlibCodec.
If you use this default constructor, you will later have to explicitly call
InitializeInflate() or InitializeDeflate() before using the ZlibCodec to compress
or decompress.
Create a ZlibCodec that either compresses or decompresses.
Indicates whether the codec should compress (deflate) or decompress (inflate).
Initialize the inflation state.
It is not necessary to call this before using the ZlibCodec to inflate data;
It is implicitly called when you call the constructor.
Z_OK if everything goes well.
Initialize the inflation state with an explicit flag to
govern the handling of RFC1950 header bytes.
By default, the ZLIB header defined in RFC 1950 is expected. If
you want to read a zlib stream you should specify true for
expectRfc1950Header. If you have a deflate stream, you will want to specify
false. It is only necessary to invoke this initializer explicitly if you
want to specify false.
whether to expect an RFC1950 header byte
pair when reading the stream of data to be inflated.
Z_OK if everything goes well.
Initialize the ZlibCodec for inflation, with the specified number of window bits.
The number of window bits to use. If you need to ask what that is,
then you shouldn't be calling this initializer.
Z_OK if all goes well.
Initialize the inflation state with an explicit flag to govern the handling of
RFC1950 header bytes.
If you want to read a zlib stream you should specify true for
expectRfc1950Header. In this case, the library will expect to find a ZLIB
header, as defined in RFC
1950, in the compressed stream. If you will be reading a DEFLATE or
GZIP stream, which does not have such a header, you will want to specify
false.
whether to expect an RFC1950 header byte pair when reading
the stream of data to be inflated.
The number of window bits to use. If you need to ask what that is,
then you shouldn't be calling this initializer.
Z_OK if everything goes well.
Inflate the data in the InputBuffer, placing the result in the OutputBuffer.
You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and
AvailableBytesOut before calling this method.
private void InflateBuffer()
{
int bufferSize = 1024;
byte[] buffer = new byte[bufferSize];
ZlibCodec decompressor = new ZlibCodec();
Console.WriteLine("\n============================================");
Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length);
MemoryStream ms = new MemoryStream(DecompressedBytes);
int rc = decompressor.InitializeInflate();
decompressor.InputBuffer = CompressedBytes;
decompressor.NextIn = 0;
decompressor.AvailableBytesIn = CompressedBytes.Length;
decompressor.OutputBuffer = buffer;
// pass 1: inflate
do
{
decompressor.NextOut = 0;
decompressor.AvailableBytesOut = buffer.Length;
rc = decompressor.Inflate(FlushType.None);
if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
throw new Exception("inflating: " + decompressor.Message);
ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut);
}
while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0);
// pass 2: finish and flush
do
{
decompressor.NextOut = 0;
decompressor.AvailableBytesOut = buffer.Length;
rc = decompressor.Inflate(FlushType.Finish);
if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK)
throw new Exception("inflating: " + decompressor.Message);
if (buffer.Length - decompressor.AvailableBytesOut > 0)
ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut);
}
while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0);
decompressor.EndInflate();
}
The flush to use when inflating.
Z_OK if everything goes well.
Ends an inflation session.
Call this after successively calling Inflate(). This will cause all buffers to be flushed.
After calling this you cannot call Inflate() without a intervening call to one of the
InitializeInflate() overloads.
Z_OK if everything goes well.
I don't know what this does!
Z_OK if everything goes well.
Initialize the ZlibCodec for deflation operation.
The codec will use the MAX window bits and the default level of compression.
int bufferSize = 40000;
byte[] CompressedBytes = new byte[bufferSize];
byte[] DecompressedBytes = new byte[bufferSize];
ZlibCodec compressor = new ZlibCodec();
compressor.InitializeDeflate(CompressionLevel.Default);
compressor.InputBuffer = System.String.ASCIIEncoding.ASCII.GetBytes(TextToCompress);
compressor.NextIn = 0;
compressor.AvailableBytesIn = compressor.InputBuffer.Length;
compressor.OutputBuffer = CompressedBytes;
compressor.NextOut = 0;
compressor.AvailableBytesOut = CompressedBytes.Length;
while (compressor.TotalBytesIn != TextToCompress.Length && compressor.TotalBytesOut < bufferSize)
{
compressor.Deflate(FlushType.None);
}
while (true)
{
int rc= compressor.Deflate(FlushType.Finish);
if (rc == ZlibConstants.Z_STREAM_END) break;
}
compressor.EndDeflate();
Z_OK if all goes well. You generally don't need to check the return code.
Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel.
The codec will use the maximum window bits (15) and the specified
CompressionLevel. It will emit a ZLIB stream as it compresses.
The compression level for the codec.
Z_OK if all goes well.
Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel,
and the explicit flag governing whether to emit an RFC1950 header byte pair.
The codec will use the maximum window bits (15) and the specified CompressionLevel.
If you want to generate a zlib stream, you should specify true for
wantRfc1950Header. In this case, the library will emit a ZLIB
header, as defined in RFC
1950, in the compressed stream.
The compression level for the codec.
whether to emit an initial RFC1950 byte pair in the compressed stream.
Z_OK if all goes well.
Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel,
and the specified number of window bits.
The codec will use the specified number of window bits and the specified CompressionLevel.
The compression level for the codec.
the number of window bits to use. If you don't know what this means, don't use this method.
Z_OK if all goes well.
Initialize the ZlibCodec for deflation operation, using the specified
CompressionLevel, the specified number of window bits, and the explicit flag
governing whether to emit an RFC1950 header byte pair.
The compression level for the codec.
whether to emit an initial RFC1950 byte pair in the compressed stream.
the number of window bits to use. If you don't know what this means, don't use this method.
Z_OK if all goes well.
Deflate one batch of data.
You must have set InputBuffer and OutputBuffer before calling this method.
private void DeflateBuffer(CompressionLevel level)
{
int bufferSize = 1024;
byte[] buffer = new byte[bufferSize];
ZlibCodec compressor = new ZlibCodec();
Console.WriteLine("\n============================================");
Console.WriteLine("Size of Buffer to Deflate: {0} bytes.", UncompressedBytes.Length);
MemoryStream ms = new MemoryStream();
int rc = compressor.InitializeDeflate(level);
compressor.InputBuffer = UncompressedBytes;
compressor.NextIn = 0;
compressor.AvailableBytesIn = UncompressedBytes.Length;
compressor.OutputBuffer = buffer;
// pass 1: deflate
do
{
compressor.NextOut = 0;
compressor.AvailableBytesOut = buffer.Length;
rc = compressor.Deflate(FlushType.None);
if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
throw new Exception("deflating: " + compressor.Message);
ms.Write(compressor.OutputBuffer, 0, buffer.Length - compressor.AvailableBytesOut);
}
while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0);
// pass 2: finish and flush
do
{
compressor.NextOut = 0;
compressor.AvailableBytesOut = buffer.Length;
rc = compressor.Deflate(FlushType.Finish);
if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK)
throw new Exception("deflating: " + compressor.Message);
if (buffer.Length - compressor.AvailableBytesOut > 0)
ms.Write(buffer, 0, buffer.Length - compressor.AvailableBytesOut);
}
while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0);
compressor.EndDeflate();
ms.Seek(0, SeekOrigin.Begin);
CompressedBytes = new byte[compressor.TotalBytesOut];
ms.Read(CompressedBytes, 0, CompressedBytes.Length);
}
whether to flush all data as you deflate. Generally you will want to
use Z_NO_FLUSH here, in a series of calls to Deflate(), and then call EndDeflate() to
flush everything.
Z_OK if all goes well.
End a deflation session.
Call this after making a series of one or more calls to Deflate(). All buffers are flushed.
Z_OK if all goes well.
Reset a codec for another deflation session.
Call this to reset the deflation state. For example if a thread is deflating
non-consecutive blocks, you can call Reset() after the Deflate(Sync) of the first
block and before the next Deflate(None) of the second block.
Z_OK if all goes well.
Set the CompressionStrategy and CompressionLevel for a deflation session.
the level of compression to use.
the strategy to use for compression.
Z_OK if all goes well.
Set the dictionary to be used for either Inflation or Deflation.
The dictionary bytes to use.
Z_OK if all goes well.
A bunch of constants used in the Zlib interface.
The maximum number of window bits for the Deflate algorithm.
The default number of window bits for the Deflate algorithm.
indicates everything is A-OK
Indicates that the last operation reached the end of the stream.
The operation ended in need of a dictionary.
There was an error with the stream - not enough data, not open and readable, etc.
There was an error with the data - not enough data, bad data, etc.
There was an error with the working buffer.
The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes.
The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes.
Represents a Zlib stream for compression or decompression.
The ZlibStream is a Decorator on a . It adds ZLIB compression or decompression to any
stream.
Using this stream, applications can compress or decompress data via
stream Read() and Write() operations. Either compresssion or
decompression can occur through either reading or writing. The compression
format used is ZLIB, which is documented in IETF RFC 1950, "ZLIB Compressed
Data Format Specification version 3.3". This implementation of ZLIB always uses
DEFLATE as the compression method. (see IETF RFC 1951, "DEFLATE
Compressed Data Format Specification version 1.3.")
The ZLIB format allows for varying compression methods, window sizes, and dictionaries.
This implementation always uses the DEFLATE compression method, a preset dictionary,
and 15 window bits by default.
This class is similar to , except that it adds the
RFC1950 header and trailer bytes to a compressed stream when compressing, or expects
the RFC1950 header and trailer bytes when decompressing. It is also similar to the
.
Create a ZlibStream using the specified CompressionMode.
When mode is CompressionMode.Compress, the ZlibStream
will use the default compression level. The "captive" stream will be
closed when the ZlibStream is closed.
This example uses a ZlibStream to compress a file, and writes the
compressed data to another file.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(fileToCompress + ".zlib"))
{
using (Stream compressor = new ZlibStream(raw, CompressionMode.Compress))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(fileToCompress & ".zlib")
Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream which will be read or written.
Indicates whether the ZlibStream will compress or decompress.
Create a ZlibStream using the specified CompressionMode and
the specified CompressionLevel.
When mode is CompressionMode.Decompress, the level parameter is ignored.
The "captive" stream will be closed when the ZlibStream is closed.
This example uses a ZlibStream to compress data from a file, and writes the
compressed data to another file.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(fileToCompress + ".zlib"))
{
using (Stream compressor = new ZlibStream(raw,
CompressionMode.Compress,
CompressionLevel.BestCompression))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(fileToCompress & ".zlib")
Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream to be read or written while deflating or inflating.
Indicates whether the ZlibStream will compress or decompress.
A tuning knob to trade speed for effectiveness.
Create a ZlibStream using the specified CompressionMode, and
explicitly specify whether the captive stream should be left open after
Deflation or Inflation.
When mode is CompressionMode.Compress, the ZlibStream will use
the default compression level.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
that will be re-read after
compression. Specify true for the parameter to leave the stream
open.
See the other overloads of this constructor for example code.
The stream which will be read or written. This is called the
"captive" stream in other places in this documentation.
Indicates whether the ZlibStream will compress or decompress.
true if the application would like the stream to remain
open after inflation/deflation.
Create a ZlibStream using the specified CompressionMode
and the specified CompressionLevel, and explicitly specify
whether the stream should be left open after Deflation or Inflation.
This constructor allows the application to request that the captive
stream remain open after the deflation or inflation occurs. By
default, after Close() is called on the stream, the captive
stream is also closed. In some cases this is not desired, for example
if the stream is a that will be
re-read after compression. Specify true for the parameter to leave the stream open.
When mode is CompressionMode.Decompress, the level parameter is
ignored.
This example shows how to use a ZlibStream to compress the data from a file,
and store the result into another file. The filestream remains open to allow
additional data to be written to it.
using (var output = System.IO.File.Create(fileToCompress + ".zlib"))
{
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (Stream compressor = new ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
// can write additional data to the output stream here
}
Using output As FileStream = File.Create(fileToCompress & ".zlib")
Using input As Stream = File.OpenRead(fileToCompress)
Using compressor As Stream = New ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
' can write additional data to the output stream here.
End Using
The stream which will be read or written.
Indicates whether the ZlibStream will compress or decompress.
true if the application would like the stream to remain open after
inflation/deflation.
A tuning knob to trade speed for effectiveness. This parameter is
effective only when mode is CompressionMode.Compress.
This property sets the flush behavior on the stream.
Sorry, though, not sure exactly how to describe all the various settings.
The size of the working buffer for the compression codec.
The working buffer is used for all stream operations. The default size is
1024 bytes. The minimum size is 128 bytes. You may get better performance
with a larger buffer. Then again, you might not. You would have to test
it.
Set this before the first call to Read() or Write() on the
stream. If you try to set it afterwards, it will throw.
Returns the total number of bytes input so far.
Returns the total number of bytes output so far.
Dispose the stream.
This may or may not result in a Close() call on the captive
stream. See the constructors that have a leaveOpen parameter
for more information.
This method may be invoked in two distinct scenarios. If disposing
== true, the method has been called directly or indirectly by a
user's code, for example via the public Dispose() method. In this
case, both managed and unmanaged resources can be referenced and
disposed. If disposing == false, the method has been called by the
runtime from inside the object finalizer and this method should not
reference other objects; in that case only unmanaged resources must
be referenced or disposed.
indicates whether the Dispose method was invoked by user code.
Indicates whether the stream can be read.
The return value depends on whether the captive stream supports reading.
Indicates whether the stream supports Seek operations.
Always returns false.
Indicates whether the stream can be written.
The return value depends on whether the captive stream supports writing.
Flush the stream.
Reading this property always throws a .
The position of the stream pointer.
Setting this property always throws a . Reading will return the total bytes
written out, if used in writing, or the total bytes read in, if used in
reading. The count may refer to compressed bytes or uncompressed bytes,
depending on how you've used the stream.
Read data from the stream.
If you wish to use the ZlibStream to compress data while reading,
you can create a ZlibStream with CompressionMode.Compress,
providing an uncompressed data stream. Then call Read() on that
ZlibStream, and the data read will be compressed. If you wish to
use the ZlibStream to decompress data while reading, you can create
a ZlibStream with CompressionMode.Decompress, providing a
readable compressed data stream. Then call Read() on that
ZlibStream, and the data will be decompressed as it is read.
A ZlibStream can be used for Read() or Write(), but
not both.
The buffer into which the read data should be placed.
the offset within that data array to put the first byte read.
the number of bytes to read.
the number of bytes read
Calling this method always throws a .
The offset to seek to....
IF THIS METHOD ACTUALLY DID ANYTHING.
The reference specifying how to apply the offset.... IF
THIS METHOD ACTUALLY DID ANYTHING.
nothing. This method always throws.
Calling this method always throws a .
The new value for the stream length.... IF
THIS METHOD ACTUALLY DID ANYTHING.
Write data to the stream.
If you wish to use the ZlibStream to compress data while writing,
you can create a ZlibStream with CompressionMode.Compress,
and a writable output stream. Then call Write() on that
ZlibStream, providing uncompressed data as input. The data sent to
the output stream will be the compressed form of the data written. If you
wish to use the ZlibStream to decompress data while writing, you
can create a ZlibStream with CompressionMode.Decompress, and a
writable output stream. Then call Write() on that stream,
providing previously compressed data. The data sent to the output stream
will be the decompressed form of the data written.
A ZlibStream can be used for Read() or Write(), but not both.
The buffer holding data to write to the stream.
the offset within that data array to find the first byte to write.
the number of bytes to write.
Compress a string into a byte array using ZLIB.
Uncompress it with .
A string to compress. The string will first be encoded
using UTF8, then compressed.
The string in compressed form
Compress a byte array into a new byte array using ZLIB.
Uncompress it with .
A buffer to compress.
The data in compressed form
Uncompress a ZLIB-compressed byte array into a single string.
A buffer containing ZLIB-compressed data.
The uncompressed string
Uncompress a ZLIB-compressed byte array into a byte array.
A buffer containing ZLIB-compressed data.
The data in uncompressed form
Specifies whether the target is inside or outside the Package.
The relationship references a part that is inside the package.
The relationship references a resource that is external to the package.
Represent an OOXML Zip package.
Compression level
If the part with a save handler should be saved. If false the part will be deleted instead of saved.
Baseclass for a relation ship between two parts in a package
Relationships collection
Updates the maximum id for the relationship
The Id
Return the maximum relation id
A relation ship between two parts in a package
The uri to the source part
The relationship type
Target, internal or external
The relationship Id
The uri to the target part
The target if it's not a valid uri, for example an internal reference to a cell withing the package.
A collection of package relationships
Relationships dictionary
Gets the enumerator for the collection
the enumerator
Number of items in the collection
Extension methods for
Returns a new range, created by skipping a number of columns from the start.
The source range
The number of columns to skip
The result range
Returns a new range, created by skipping a number of rows from the start.
The source range
The number of rows to skip
The result range
Returns a new range, created by taking a number of columns from the start.
If is greater than number of columns in the source range
the entire source range will be returned.
The source range
The number of columns to take
The result range
Returns a new range, created by taking a number of rows from the start.
If is greater than number of rows in the source range
the entire source range will be returned.
The source range
The number of columns to take
The result range
Returns a single column as a new range.
The source range
Offset of the column (zero-based) in the source range
The requested row
Returns a new range, created by taking a specific number of columns between from the offset parameter.
The source range
Offset of the start-column (zero-based)
The number of columns to take
The result range
Returns a single row as a new range.
The source range
Offset of the row (zero-based) in the source range
The requested row
Returns a new range, created by taking a specific number of rows based on the offset parameter.
The source range
Offset of the start-row (zero-based)
The number of rows to take
The result range
Returns a single cell within a range
The source range
Offset of the cell's row within the range (zero-based)
Offset of the cell's column within the range (zero-based)
Indicates that the fallback value is a Boolean.
Indicates that the fallback value is a decimal.
Indicates fallback value is an error.
Indicates that the fallback value is a string.
Flags used for rich data.
False indicates that we hide this key value pair (KVP) in the default Card View
False indicates that we hide this key value pair (KVP) from formulas and the object model
False indicates that we hide this key value pair (KVP) from AutoComplete, sort, filter, and Find
True indicates that we do not write this key value pair (KVP) into the file, it only exists in memory
True indicates that we exclude this key value pair (KVP) when comparing rich values.
Constructor
Critieras for sorting a range left to right
Sorts by the column that corresponds to the (zerobased) with ascending sort direction
The row to sort on
A for adding more sort criterias
Sorts by the column that corresponds to the (zerobased) using the supplied sort direction.
The column to sort on
Ascending or Descending sort
A for adding more sort criterias
This class is used to build multiple search parameters for columnbased sorting.
Adds a new sort layer
Use a custom list for sorting on the current Sort layer.
An array of strings defining the sort order
A
This class represents a condition in a sort.
Sorts by the column that corresponds to the (zerobased) with ascending sort direction
The column to sort
A for adding more sort criterias
Sorts by the column that corresponds to the (zerobased) using the supplied sort direction.
The column to sort
Ascending or Descending sort
A for adding more sort criterias
This class is used to build multiple search parameters for rowbased sorting.
Adds a new Sort layer to the sort options (i.e. the sort).
Use a custom list for sorting on the current Sort layer.
An array of strings defining the sort order
A
Sort options for sorting a range.
Creates a new instance.
Creates the first sort layer (i.e. the first sort condition) for a row based/top to bottom sort.
Creates the first sort layer (i.e. the first sort condition) for a column based/left to right sort.
Represents a sort condition within a sort
Sort direction of this condition. If false - ascending, if true - descending.
Address of the range used by this condition.
A custom list of strings that defines the sort order for this condition.
A collection of s.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Adds a new condition to the collection.
Address of the range used by this condition.
If true - descending sort order, if false or null - ascending sort order.
Adds a new condition to the collection.
Address of the range used by this condition.
If true - descending sort order, if false or null - ascending sort order.
A custom list of strings that defines the sort order for this condition.
Removes all sort conditions
Base class for sort layers
Sets the column
Sets the column
Column to sort
Sort order
Sets the row
Sets the row
Base class for Sort options.
Constructor
Culture to use in sort
Compare options to use in sort
Preserves the AutoFilter sort state.
Removes all sort conditions
The preserved sort conditions of the sort state.
Indicates whether or not the sort is case-sensitive
Indicates whether or not to sort by columns.
The whole range of data to sort (not only the sort-by column)
Table sort layer
Sorts by the column that corresponds to the (zerobased) with ascending sort direction
The column to sort
A for adding more sort criterias
Sorts by the column that corresponds to the (zerobased) using the supplied sort direction.
The column to sort
Ascending or Descending sort
A for adding more sort criterias
Sorts by the column that corresponds to the ith ascending sort direction
The name of the column to sort, see .
A for adding more sort criterias
Sorts by the column that corresponds to the using the supplied sort direction.
Name of the column to sort, see
Ascending or Descending sort
A for adding more sort criterias
Used to create sort criterias for sorting a range.
Add a new Sort layer.
Use a custom list for sorting on the current Sort layer.
An array of strings defining the sort order
A
Sort options for sorting an
Constructor
The table sort
Defines the first .
Show empty cells as
Connect datapoints with line
A gap
As Zero
Type of sparkline
Line Sparkline
Column Sparkline
Win/Loss Sparkline
Axis min/max settings
Individual per sparklines
Same for all sparklines
A custom value
Represents a single sparkline within the sparkline group
The datarange
Location of the sparkline
Returns a string representation of the object
The cell address and the range
Collection of sparklines
Number of sparklines in the collection
Returns the sparklinegroup at the specified position.
The position of the Sparklinegroup. 0-base
Gets the enumerator for the collection
The enumerator
Sparkline colors
Indexed color
RGB
The theme color
The tint value
Color is set to automatic
Sets a color
The color
Sets a theme color
The color
Sets an indexed color
The color
Sets the color to auto
Represents a group of sparklines
The range containing the dateaxis from the sparklines.
Set to Null to remove the dateaxis.
The range containing the data from the sparklines
The range containing the sparklines
The Sparklines for the sparklinegroup
Highlight each point in each sparkline in the sparkline group.
Applies to line sparklines only
Highlight the highest point of data in the sparkline group
Highlight the lowest point of data in the sparkline group
Highlight the first point of data in the sparkline group
Highlight the last point of data in the sparkline group
Highlight negative points of data in the sparkline group with a different color or marker
Displays the X axis
Display hidden cells
The weight of the line. Applies to line sparklines only.
How to display empty cells in the series
Type of sparkline
Sparkline color
Markercolor for the lowest negative point
Markercolor for the lowest negative point
Default marker color
The color of the first point
The color of the last point
The color of the point with the highest value
The color of the point with the lowest value
When MinAxisType type is set to Custom, this value sets the minimum value
When MaxAxisType type is set to Custom, this value sets the maximum value
Vertical axis minimum value options
Vertical axis maximum value options
Plot horizontal axis data right to left if true
A collection of sparkline groups
Number of items in the collection
Adds a new sparklinegroup to the collection
Type of sparkline
The location of the sparkline group. The range must have one row or column and must match the number of rows/columns in the datarange
The data for the sparkline group
Returns the sparklinegroup at the specified position.
The position of the Sparklinegroup. 0-base
The enumerator for the collection
The enumerator
Removes the sparkline.
The index of the item to be removed
Removes the sparkline.
The sparklinegroup to be removed
Base class for differential formatting styles.
Reset all properties for the style.
The id
If the style has any value set
Create the nodes
The xml helper
The Xpath
Sets the values from an XmlHelper instance.
The helper
Set the cell style values from the dxf using the callback method.
Clone the object
Set the color value
The xml helper
The x path
The color
Same as SetValue but will set first char to lower case.
The xml helper
The Xpath
The value
Sets the value
The xml helper
The x path
The object
Sets the value
The xml helper
The x path
The string
Sets the value
The xml helper
The x path
The boolean value
Is this value allowed to be changed?
Represents a cell alignment properties used for differential style formatting.
Horizontal alignment.
Vertical alignment.
String orientation in degrees. Values range from 0 to 180 or 255.
Setting the rotation to 255 will align text vertically.
Wrap the text
The margin between the border and the text
The additional number of spaces of indentation to adjust for text in a cell.
If the cells justified or distributed alignment should be used on the last line of text.
Shrink the text to fit
Reading order
0 - Context Dependent
1 - Left-to-Right
2 - Right-to-Left
Makes the text vertically. This is the same as setting to 255.
If the dxf style has any values set.
Clears all properties
The border style of a drawing in a differential formatting record
Left border style
Right border style
Top border style
Bottom border style
Horizontal border style
Vertical border style
The Id
Creates the the xml node
The xml helper
The X Path
If the object has any properties set
Clears all properties
Set the border properties for Top/Bottom/Right and Left.
The border style
The theme color
Set the border properties for Top/Bottom/Right and Left.
The border style
The color to use
Clone the object
A new instance of the object
A single border line of a drawing in a differential formatting record
The border style
The color of the border
The Id
Creates the the xml node
The xml helper
The X Path
If the object has any properties set
Clears all properties
Clone the object
A new instance of the object
A color in a differential formatting record
Gets or sets a theme color
Gets or sets an indexed color
Gets or sets the color to automatic
Gets or sets the Tint value for the color
Sets the color.
The Id
Set the color of the drawing based on an RGB color. This method will remove any previous
ThemeSchemeColor, IndexedColor
or Automatic color used.
The color
Set the color of the drawing based on an color.
This method will remove any previous ,
IndexedColor or Automatic color used.
The color
Set the color of the drawing based on an color.
This method will remove any previous Color,
ThemeSchemeColor or Automatic color used.
The color
Set the color to automatic
Set the color of the object
Alpha component value
Red component value
Green component value
Blue component value
Clone the object
A new instance of the object
If the object has any properties set
Clears all properties
Creates the the xml node
The xml helper
The X Path
Return the RGB value as a string for the color object that uses the Indexed or Tint property
The RGB color starting with a #FF (alpha)
A fill in a differential formatting record
The pattern tyle
The color of the pattern
The background color
The Id
Fill style for a differential style record
Gradient fill settings
Creates the the xml node
The xml helper
The X Path
If the object has any properties set
Clears the fill
Clone the object
A new instance of the object
A font in a differential formatting record
The font size
The name of the font
Font family
Font-Vertical Align
Displays only the inner and outer borders of each character. Similar to bold
Shadow for the font. Used on Macintosh only.
Condence (squeeze it together). Used on Macintosh only.
Extends or stretches the text. Legacy property used in older speadsheet applications.
Which font scheme to use from the theme
The Id to identify the font uniquely
Clone the object
A new instance of the object
If the object has any properties set
Clears all properties
A base class for differential formatting font styles
Font bold
Font Italic
Font-Strikeout
The color of the text
The underline type
The id
Creates the the xml node
The xml helper
The X Path
If the object has any properties set
Clears all properties
Clone the object
A new instance of the object
Represents a gradient fill used for differential style formatting.
If the object has any properties set
Clears all properties
A collection of colors and percents for the gradient fill
Type of gradient fill
Angle of the linear gradient
The left position of the inner rectangle (color 1).
The right position of the inner rectangle (color 1).
The top position of the inner rectangle (color 1).
The bottom position of the inner rectangle (color 1).
Represents a position of a color in a gradient list for differencial styles.
The position of the color
The color to use at the position
If the object has any properties set
Clears all colors
A collection of colors and their positions used for a gradiant fill.
Get the enumerator
The enumerator
Get the enumerator
The enumerator
Indexer for the collection
The index in the collection
The color
Gets the first occurance with the color with the specified position
The position in percentage
The color
Adds a RGB color at the specified position
Where position is in percent
The position from 0 to 100%
The gradient color position object
Number of items in the collection
If the style has any value set
Remove the style at the index in the collection.
Remove the style at the position from the collection.
Remove the style from the collection
Clear all style items from the collection
A numberformat in a differential formatting record
Id for number format
Build in ID's
- 0 General
- 1 0
- 2 0.00
- 3 #,##0
- 4 #,##0.00
- 9 0%
- 10 0.00%
- 11 0.00E+00
- 12 # ?/?
- 13 # ??/??
- 14 mm-dd-yy
- 15 d-mmm-yy
- 16 d-mmm
- 17 mmm-yy
- 18 h:mm AM/PM
- 19 h:mm:ss AM/PM
- 20 h:mm
- 21 h:mm:ss
- 22 m/d/yy h:mm
- 37 #,##0 ;(#,##0)
- 38 #,##0 ;\[Red\](#,##0)
- 39 #,##0.00;(#,##0.00)
- 40 #,##0.00;\[Red\](#,##0.00)
- 45 mm:ss
- 46 \[h\]:mm:ss
- 47 mmss.0
- 48 ##0.0E+0
- 49
@
The number format
s
The id
Creates the the xml node
The xml helper
The X Path
If the object has any properties set
Clears all properties
Clone the object
A new instance of the object
Represents a cell protection properties used for differential style formatting.
If the cell is locked when the worksheet is protected.
If the cells formulas are hidden when the worksheet is protected.
If the dxf style has any values set.
Clears all properties
Differential formatting record used in conditional formatting
Differential formatting record used in conditional formatting
Font formatting settings
Number format settings
Cell alignment properties
Cell protection properties used when the worksheet is protected.d
If the object has any properties set
Clears all properties
Base class for differential formatting styles
Fill formatting settings
Border formatting settings
Id
Creates the node
The helper
The XPath
If the object has any properties set
Clears all properties
Differential formatting record used in conditional formatting
Number format settings
If the object has any properties set
Clears all properties
Differential formatting record used in conditional formatting
Font formatting settings
If the object has any properties set
Clears all properties
Differential formatting record with limited font settings
Font formatting settings
Clone the object
A new instance of the object
If the object has any properties set
Clears all properties
Differential formatting record used for table styles
Fill style for a differential style
Fill using the selected pattern and color
A gradient fill using multiple colors.
Type of gradient fill
Linear gradient type. Linear gradient type means that the transition from one color to the next is along a line.
Path gradient type. Path gradient type means the that the transition from one color to the next is a rectangle, defined by coordinates.
Type of font strike
Double-lined font strike
No font strike
Single-lined font strike
Custom style element for a table / pivot table
Style that applies to a pivot table's blank rows.
Style that applies to a pivot table's first column.
Style that applies to a pivot table's first column stripes.
Style that applies to a pivot table's first column subheading.
Style that applies to a pivot table's first header row cell.
Style that applies to a pivot table's first row stripes.
Style that applies to a pivot table's first row subheading.
Style that applies to a pivot table's first subtotal column.
Style that applies to a pivot table's first subtotal row.
Style that applies to a pivot table's header row.
Style that applies to a pivot table's last column.
Style that applies to a pivot table's page field labels.
Style that applies to a pivot table's page field values.
Style that applies to a pivot table's second column stripes.
Style that applies to a pivot table's second column subheading.
Style that applies to a pivot table's second row stripes.
Style that applies to a pivot table's second row subheading.
Style that applies to a pivot table's second subtotal column.
Style that applies to a pivot table's second subtotal row.
Style that applies to a pivot table's third column subheading.
Style that applies to a pivot table's third row subheading.
Style that applies to a pivot table's third subtotal column.
Style that applies to a pivot table's third subtotal row.
Style that applies to a pivot table's total row.
Style that applies to a pivot table's entire content.
Style that applies to a table's last header row cell.
Style that applies to a table's first total row cell.
Style that applies to a table's last total row cell.
Linestyle
Dashed
Dashed, Thicker
Dashed Long
Long Dashed, Thicker
Double lines with normal thickness
Dot Dash
Dot Dash, Thicker
Dot Dot Dash
Dot Dot Dash, Thicker
Dotted
Dotted, Thicker
Single line, Thicker
No underline
Single line
A single wavy line
A double wavy line
A single wavy line, Thicker
Underline just the words and not the spaces between them
Border line style
No border style
Hairline
Dotted
Dash Dot
Thin single line
Dash Dot Dot
Dashed
Dash Dot Dot, medium thickness
Dashed, medium thickness
Dash Dot, medium thickness
Single line, Thick
Single line, medium thickness
Double line
Type of gradient fill
No gradient fill.
Linear gradient type. Linear gradient type means that the transition from one color to the next is along a line.
Path gradient type. Path gradient type means the that the transition from one color to the next is a rectangle, defined by coordinates.
Fill pattern
No fill
A solid fill
Dark gray
Excel name: 75% Gray
Medium gray
Excel name: 50% Gray
Light gray
Excel name: 25% Gray
Grayscale of 0.125, 1/8
Excel name: 12.5% Gray
Grayscale of 0.0625, 1/16
Excel name: 6.25% Gray
Dark vertical
Excel name: Vertical Stripe
Dark horizontal
Excel name: Horizontal Stripe
Dark down
Excel name: Reverse Diagonal Stripe
Dark up
Excel name: Diagonal Stripe
Dark grid
Excel name: Diagonal Crosshatch
Dark trellis
Excel name: Thick Diagonal Crosshatch
Light vertical
Excel name: Thin Vertical Stripe
Light horizontal
Excel name: Thin Horizontal Stripe
Light down
Excel name: Thin Reverse Diagonal Stripe
Light up
Excel name: Thin Diagonal Stripe
Light grid
Excel name: Thin Horizontal Crosshatch
Light trellis
Excel name: Thin Diagonal Crosshatch
Horizontal text alignment
General aligned
Left aligned
Center aligned
The horizontal alignment is centered across multiple cells
Right aligned
The value of the cell should be filled across the entire width of the cell.
Each word in each line of text inside the cell is evenly distributed across the width of the cell
The horizontal alignment is justified to the Left and Right for each row.
An indexed color
Black
White
Red
Lime
Blue
Yellow
Magenta
Aqua
Black
White
Red
Lime
Blue
Yellow
Magenta
Aqua
Maroon (#00800000)
Green (#00008000)
Navy (#00000080)
ARGB #00808000
ARGB #00800080
ARGB #00008080
ARGB #00C0C0C0
ARGB #00808080
ARGB #009999FF
ARGB #00993366
ARGB #00FFFFCC
ARGB #00CCFFFF
ARGB #00660066
ARGB #00FF8080
ARGB #000066CC
ARGB #00CCCCFF
ARGB #00000080
ARGB #00FF00FF
ARGB #00FFFF00
ARGB #0000FFFF
ARGB #00800080
ARGB #00800000
ARGB #00008080
ARGB #000000FF
ARGB #0000CCFF
ARGB #00CCFFFF
ARGB #00CCFFCC
ARGB #00FFFF99
ARGB #0099CCFF
ARGB #00FF99CC
ARGB #00CC99FF
ARGB #00FFCC99
ARGB #003366FF
ARGB #0033CCCC
ARGB #0099CC00
ARGB #00FFCC00
ARGB #00FF9900
ARGB #00FF6600
ARGB #00666699
ARGB #00969696
ARGB #00003366
ARGB #00339966
ARGB #00003300
ARGB #00333300
ARGB #00993300
ARGB #00993366
ARGB #00333399
ARGB #00333333
System foreground color
System background color
The reading order
Reading order is determined by the first non-whitespace character
Left to Right
Right to Left
Font-Underlinestyle for
No underline
Single underline
Double underline
Single line accounting. The underline is drawn under characters such as j and g
Double line accounting. The underline is drawn under of characters such as j and g
Vertical text alignment
Top aligned
Center aligned
Bottom aligned
Distributed. Each line of text inside the cell is evenly distributed across the height of the cell
Justify. Each line of text inside the cell is evenly distributed across the height of the cell
Font-Vertical Align
None
The text in the parent run will be located at the baseline and presented in the same size as surrounding text
The text will be subscript.
The text will be superscript.
Cell Border style
Left border style
Right border style
Top border style
Bottom border style
0Diagonal border style
A diagonal from the bottom left to top right of the cell
A diagonal from the top left to bottom right of the cell
Set the border style around the range.
The border style
Set the border style around the range.
The border style
The color of the border
Cell border style
The line style of the border
The color of the border
Color for cellstyling
The theme color
The tint value
The RGB value
The indexed color number.
A negative value means not set.
Auto color
Set the color of the object
The color
Set the color of the object
The color
Set the color of the object
The color
Set the color to automatic
Set the color of the object
Alpha component value
Red component value
Green component value
Blue component value
Return the RGB hex string for the Indexed or Tint property
The RGB color starting with a #FF (alpha)
Return the RGB value as a string for the color object that uses the Indexed or Tint property
The color object
The RGB color starting with a #FF (alpha)
The background fill of a cell
The pattern for solid fills.
The color of the pattern
The background color
Access to properties for gradient fill.
Set the background to a specific color and fillstyle
the color
The fillstyle. Default Solid
Set the background to a specific color and fillstyle
The indexed color
The fillstyle. Default Solid
Set the background to a specific color and fillstyle
The theme color
The fillstyle. Default Solid
Cell style Font
The name of the font
The Size of the font
Font family
Cell color
Scheme
Font-bold
Font-italic
Font-Strikeout
Font-Underline
The underline style
Font-Vertical Align
The character set for the font
The following values can be used for this property
f
ValueDescription
- 0x00
- The ANSI character set. (IANA name iso-8859-1)
- 0x01
- The default character set.
- 0x02
- The Symbol character set. This value specifies that the characters in the Unicode private use area(U+FF00 to U+FFFF) of the font should be used to display characters in the range U+0000 to U+00FF.
- 0x4D
- A Macintosh(Standard Roman) character set. (IANA name macintosh)
- 0x80
- The JIS character set. (IANA name shift_jis)
- 0x81
- The Hangul character set. (IANA name ks_c_5601-1987)
- 0x82
- A Johab character set. (IANA name KS C-5601-1992)
- 0x86
- The GB-2312 character set. (IANA name GBK)
- 0x88
- The Chinese Big Five character set. (IANA name Big5)
- 0xA1
- A Greek character set. (IANA name windows-1253)
- 0xA2
- A Turkish character set. (IANA name iso-8859-9)
- 0xA3
- A Vietnamese character set. (IANA name windows-1258)
- 0xB1
- A Hebrew character set. (IANA name windows-1255)
- 0xB2
- An Arabic character set. (IANA name windows-1256)
- 0xBA
- A Baltic character set. (IANA name windows-1257)
- 0xCC
- A Russian character set. (IANA name windows-1251)
- 0xDE
- A Thai character set. (IANA name windows-874)
- 0xEE
- An Eastern European character set. (IANA name windows-1250)
- 0xFF
- An OEM character set not defined by ISO/IEC 29500.
- Any other value
- Application-defined, can be ignored
Set the font from a Font object
Font family name
Font size
The background fill of a cell
Angle of the linear gradient
Linear or Path gradient
The top position of the inner rectangle (color 1) in percentage format (from the top to the bottom).
Spans from 0 to 1
The bottom position of the inner rectangle (color 1) in percentage format (from the top to the bottom).
Spans from 0 to 1
The left position of the inner rectangle (color 1) in percentage format (from the left to the right).
Spans from 0 to 1
The right position of the inner rectangle (color 1) in percentage format (from the left to the right).
Spans from 0 to 1
Gradient Color 1
Gradient Color 2
The numberformat of the cell
The numeric index for the format
The numberformat
If the numeric format is a build-in from.
Toplevel class for cell styling
Numberformat
Font styling
Fill Styling
Border
The horizontal alignment in the cell
The vertical alignment in the cell
If the cells justified or distributed alignment should be used on the last line of text.
Wrap the text
Readingorder
Makes the text vertically. This is the same as setting to 255.
Shrink the text to fit
The margin between the border and the text
Text orientation in degrees. Values range from 0 to 180 or 255.
Setting the rotation to 255 will align text vertically.
If true the cell is locked for editing when the sheet is protected
If true the formula is hidden when the sheet is protected.
If true the cell has a quote prefix, which indicates the value of the cell is text.
The index in the style collection
Used by Rich-text and Paragraphs.
The latin typeface name
The East Asian typeface name
The complex font typeface name
Creates the top nodes of the collection
If the font is bold
The fonts underline style
The fonts underline color
If the font is italic
Font strike out type
Font size
A reference to the fill properties
Sets the default color of the text.
This sets the Fill to a SolidFill with the specified color.
Use the Fill property for more options
Specifies the minimum font size at which character kerning occurs for this text run
Set the font style properties
Font family name
Font size
Handels paragraph text
Text
If the paragraph is the first in the collection
If the paragraph is the last in the collection
A collection of Paragraph objects
The indexer for this collection
The index
Number of items in the collection
Add a rich text string
The text to add
This will be a new line. Is ignored for first item added to the collection
Removes all items in the collection
Remove the item at the specified index
The index
Remove the specified item
The item
The full text
A richtext part
A referens to the richtext collection
Preserves whitespace. Default true
Bold text
Italic text
Strike-out text
Underlined text
True sets UnderLineType to Single
False sets UnderLineType to None
Vertical Alignment
Font size
Name of the font
Text color.
Also see
Color settings.
Characterset to use
Font family
Underline type of text
The text
Get the underline typ for rich text
returns excelunderline type
Get the underline typ for rich text
returns excelunderline type
Returns the rich text item as a html string.
Read RichText attributes from xml.
Write RichTextAttributes
Has default value
Collection of Richtext objects
Collection containing the richtext objects
Items in the list
Add a rich text string
The text to add
Adds a new paragraph after the . This will add a new line break.
Insert a rich text string at the specified index.
The zero-based index at which rich text should be inserted.
The text to insert.
Clear the collection
Removes an item at the specific index
Removes an item
The text
Returns the rich text as a html string.
The rgb color value set in the file.
The color theme.
The tint value for the color.
Auto color
The indexed color number.
A negative value means not set.
Base class for styles
A style element for a custom table style with band size
Band size. Only applicable when is set to FirstRowStripe, FirstColumnStripe, SecondRowStripe or SecondColumnStripe
A custom named table style that applies to pivot tables only
If the style applies to tables, pivot table or both
Applies to the page field labels of a pivot table
Applies to the page field values of a pivot table
Applies to the first subtotal column of a pivot table
Applies to the second subtotal column of a pivot table
Applies to the third subtotal column of a pivot table
Applies to blank rows of a pivot table
Applies to the first subtotal row of a pivot table
Applies to the second subtotal row of a pivot table
Applies to the third subtotal row of a pivot table
Applies to the first column subheading of a pivot table
Applies to the second column subheading of a pivot table
Applies to the third column subheading of a pivot table
Applies to the first row subheading of a pivot table
Applies to the second row subheading of a pivot table
Applies to the third row subheading of a pivot table
A custom named table style that applies to both tables and pivot tables
If the style applies to tables, pivot table or both
Applies to the last header cell of a table
Applies to the first total cell of a table
Applies to the last total cell of a table
A custom named table style that applies to tables only
Applies to the last header cell of a table
Applies to the first total cell of a table
Applies to the last total cell of a table
If the style applies to tables, pivot table or both
Provides a simple way to type cast a table named style objects to its top level class.
Converts the table named style object to it's top level or another nested class.
The type of table named style object. T must be inherited from ExcelTableNamedStyleBase
The table named style as type T
Returns the table named style object as a named style for tables only
The table named style object
Returns the table named style object as a named style for pivot tables only
The pivot table named style object
Returns the table named style object as a named style that can be applied to both tables and pivot tables.
The shared table named style object
A base class for custom named table styles
If a table style is applied for a table/pivot table or both
The name of the table named style
Applies to the entire content of a table or pivot table
Applies to the first column stripe of a table or pivot table
Applies to the second column stripe of a table or pivot table
Applies to the first row stripe of a table or pivot table
Applies to the second row stripe of a table or pivot table
Applies to the last column of a table or pivot table
Applies to the first column of a table or pivot table
Applies to the header row of a table or pivot table
Applies to the total row of a table or pivot table
Applies to the first header cell of a table or pivot table
Provides access to type conversion for all table named styles.
A style element for a custom slicer style with band
Access to style settings
The type of custom style element for a table style
A style element for a custom table style
Access to style properties
The type of table style element for a custom table style.
Xml access class for border items
Cell Border style
The color of the line
s
True if the record exists in the underlaying xml
Xml access class for border top level
Left border style properties
Right border style properties
Top border style properties
Bottom border style properties
Diagonal border style properties
Diagonal up border
Diagonal down border
Xml access class for color
Set the color to automatic
Theme color value
The Tint value for the color
The RGB value
Indexed color value.
Returns int.MinValue if indexed colors are not used.
Sets the color
The color
Sets a theme color
The theme color
Sets an indexed color
The indexed color
True if the record exists in the underlaying xml
Xml access class for fills
Cell fill pattern style
Pattern color
Cell background color
Xml access class for fonts
The name of the font
Font size
Font family
Text color
Font Scheme
If the font is bold
If the font is italic
If the font is striked out
If the font is underlined.
When set to true a the text is underlined with a single line
If the font is underlined
Vertical aligned
The character set for the font
The following values can be used for this property.
ValueDescription
- null
- Not specified
- 0x00
- The ANSI character set. (IANA name iso-8859-1)
- 0x01
- The default character set.
- 0x02
- The Symbol character set. This value specifies that the characters in the Unicode private use area(U+FF00 to U+FFFF) of the font should be used to display characters in the range U+0000 to U+00FF.
- 0x4D
- A Macintosh(Standard Roman) character set. (IANA name macintosh)
- 0x80
- The JIS character set. (IANA name shift_jis)
- 0x81
- The Hangul character set. (IANA name ks_c_5601-1987)
- 0x82
- A Johab character set. (IANA name KS C-5601-1992)
- 0x86
- The GB-2312 character set. (IANA name GBK)
- 0x88
- The Chinese Big Five character set. (IANA name Big5)
- 0xA1
- A Greek character set. (IANA name windows-1253)
- 0xA2
- A Turkish character set. (IANA name iso-8859-9)
- 0xA3
- A Vietnamese character set. (IANA name windows-1258)
- 0xB1
- A Hebrew character set. (IANA name windows-1255)
- 0xB2
- An Arabic character set. (IANA name windows-1256)
- 0xBA
- A Baltic character set. (IANA name windows-1257)
- 0xCC
- A Russian character set. (IANA name windows-1251)
- 0xDE
- A Thai character set. (IANA name windows-874)
- 0xEE
- An Eastern European character set. (IANA name windows-1250)
- 0xFF
- An OEM character set not defined by ISO/IEC 29500.
- Any other value
- Application-defined, can be ignored
Set the font properties
Font family name
Font size
Gets the height of the font in
Translates Excels format to .NET format
Xml access class for gradient fillsde
Type of gradient fill.
Angle of the linear gradient
Gradient color 1
Gradient color 2
Percentage format bottom
Percentage format top
Percentage format left
Percentage format right
Xml access class for named styles
Named style index
Style index
The build in Id for the named style
Indicates if this built-in cell style has been customized
Name of the style
The style object
Xml access class for number customFormats
If the number format is build in
Id for number format
Build in ID's
0 General
1 0
2 0.00
3 #,##0
4 #,##0.00
9 0%
10 0.00%
11 0.00E+00
12 # ?/?
13 # ??/??
14 mm-dd-yy
15 d-mmm-yy
16 d-mmm
17 mmm-yy
18 h:mm AM/PM
19 h:mm:ss AM/PM
20 h:mm
21 h:mm:ss
22 m/d/yy h:mm
37 #,##0;(#,##0)
38 #,##0;[Red] (#,##0)
39 #,##0.00;(#,##0.00)
40 #,##0.00;[Red] (#,##0.00)
45 mm:ss
46 [h]:mm:ss
47 mmss.0
48 ##0.0E+0
49 @
The numberformat string
Xml access class xfs records. This is the top level style object.
Style index
Numberformat properties
Font properties
Fill properties
Border style properties
Horizontal alignment
Vertical alignment
If the cells justified or distributed alignment should be used on the last line of text
Wraped text
Text rotation angle
Locked when sheet is protected
Hide formulas when sheet is protected
Prefix the formula with a quote.
Readingorder
Shrink to fit
Indentation
Xml helper class for cell style classes
Defines if a table style applies to a Table / PivotTable or Both
The named style applies to tables only
The named style applies to pivot tables only
The named style can be applied to both tables and pivot tables
Option for which data should overwrite the other in a sync.
Overwrite cells with column name data
Overwrite columnNames with cell data
Pivot table style Enum
No table style
Custom table style
Light style 1
Light style 2
Light style 3
Light style 4
Light style 5
Light style 6
Light style 7
Light style 8
Light style 9
Light style 10
Light style 11
Light style 12
Light style 13
Light style 14
Light style 15
Light style 16
Light style 17
Light style 18
Light style 19
Light style 20
Light style 21
Light style 22
Light style 23
Light style 24
Light style 25
Light style 26
Light style 27
Light style 28
Medium style 1
Medium style 2
Medium style 3
Medium style 4
Medium style 5
Medium style 6
Medium style 7
Medium style 8
Medium style 9
Medium style 10
Medium style 11
Medium style 12
Medium style 13
Medium style 14
Medium style 15
Medium style 16
Medium style 17
Medium style 18
Medium style 19
Medium style 20
Medium style 21
Medium style 22
Medium style 23
Medium style 24
Medium style 25
Medium style 26
Medium style 27
Medium style 28
Dark style 1
Dark style 2
Dark style 3
Dark style 4
Dark style 5
Dark style 6
Dark style 7
Dark style 8
Dark style 9
Dark style 10
Dark style 11
Dark style 12
Dark style 13
Dark style 14
Dark style 15
Dark style 16
Dark style 17
Dark style 18
Dark style 19
Dark style 20
Dark style 21
Dark style 22
Dark style 23
Dark style 24
Dark style 25
Dark style 26
Dark style 27
Dark style 28
Build-in table row functions
Average
Count
Count, numbers
Custum function
Maximum
Minimum
None
Standard deviation
Summary
Variation
Table style Enum
No table style
Custom table style
Light style 1
Light style 2
Light style 3
Light style 4
Light style 5
Light style 6
Light style 7
Light style 8
Light style 9
Light style 10
Light style 11
Light style 12
Light style 13
Light style 14
Light style 15
Light style 16
Light style 17
Light style 18
Light style 19
Light style 20
Light style 21
Medium style 1
Medium style 2
Medium style 3
Medium style 4
Medium style 5
Medium style 6
Medium style 7
Medium style 8
Medium style 9
Medium style 10
Medium style 11
Medium style 12
Medium style 13
Medium style 14
Medium style 15
Medium style 16
Medium style 17
Medium style 18
Medium style 19
Medium style 20
Medium style 21
Medium style 22
Medium style 23
Medium style 24
Medium style 25
Medium style 26
Medium style 27
Medium style 28
Dark style 1
Dark style 2
Dark style 3
Dark style 4
Dark style 5
Dark style 6
Dark style 7
Dark style 8
Dark style 9
Dark style 10
Dark style 11
An Excel Table
Provides access to the XML data representing the table in the package.
The package internal URI to the Table Xml Document.
The name of the table object in Excel
The worksheet of the table
The address of the table
The table range
Converts the table range to CSV format
Creates an object to export the table to HTML
The exporter object
Converts the table range to CSV format
Parameters/options for conversion to text
Converts the table range to CSV format
Converts the table range to CSV format
Exports the table to a file
The export file
Export options
Exports the table to a
Data will be exported to this stream
Export options
Exports the table to a
Data will be exported to this stream
Export options
Exports the table to a file
Data will be exported to this stream
Export options
Save the table to json
The stream to save to.
Save the table to json
The stream to save to.
Settings for the json output.
Exports the table to a
A containing the data in the table range
Returns the table as a JSON string
A string containing the JSON document.
Returns the table as a JSON string
Settings to configure the JSON output
A string containing the JSON document.
Saves the table as a JSON string to a string
The stream to write the JSON to.
Saves the table as a JSON string to a string
The stream to write the JSON to.
Settings to configure the JSON output
Exports the table to a
A containing the data in the table range
Exports the table to a
A containing the data in the table range
Returns a collection of T for the tables data range. The total row is not included.
The table must have headers.
Headers will be mapped to properties using the name or the objects attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to map to
A list of T
Returns a collection of T for the tables data range. The total row is not included.
The table must have headers.
Headers will be mapped to properties using the name or the property attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to map to
Configures the settings for the function
A list of T
Returns a collection of T for the tables data range. The total row is not included.
The table must have headers.
Headers will be mapped to properties using the name or the property attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to map to
Settings for the method
A list of T
Returns a collection of T for the table.
If the range contains multiple addresses the first range is used.
The the table must have headers.
Headers will be mapped to properties using the name or the attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to map to
The call back function to map each row to the item of type T.
A list of T
Returns a collection of T for the table.
If the range contains multiple addresses the first range is used.
The the table must have headers.
Headers will be mapped to properties using the name or the attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to map to
The call back function to map each row to the item of type T.
Configures the settings for the function
A list of T
Returns a collection of T for the table.
If the range contains multiple addresses the first range is used.
The the table must have headers.
Headers will be mapped to properties using the name or the attributes without white spaces.
The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
The type to map to
The call back function to map each row to the item of type T.
Configures the settings for the function
A list of T
Collection of the columns in the table
The table style. If this property is custom, the style from the StyleName propery is used.
Update column names with cell values or cell values with column names
overwrites the top row cell values with the column names.
overwrites the column names with the top row cell values.
If the cell is empty it instead overwrites the cell value with the column name unless is set to false.
Target data to be overwritten
Set to false to not fill empty cell with column name
Ensures the top cell in each column of the table contains only the column name
Ensures the column name of each column matches the current cellValue. Unless cell value is null.
If cell value is null and column name exists sets cell value to column name.
Set input parameter false to not overwrite empty cells.
Set to false to not fill cell with column name when its null or empty
If the header row is visible or not
Autofilter settings for the table
If the header row has an autofilter
If the total row is visible or not
The style name for custum styles
Display special formatting for the first row
Display special formatting for the last row
Display banded rows
Display banded columns
Named style used for the total row
Named style used for the data cells
Named style used for the header row
Checkes if two tables are the same
Table 1
Table 2
Returns a hashcode generated from the TableXml
The table
The hashcode
Adds new rows to the table.
Number of rows to add to the table. Default is 1
Inserts one or more rows before the specified position in the table.
The position in the table where the row will be inserted. Default is in the end of the table. 0 will insert the row at the top. Any value larger than the number of rows in the table will insert a row at the bottom of the table.
Number of rows to insert.
Copy styles from the row above. If inserting a row at position 0, the first row will be used as a template.
The inserted range
Deletes one or more rows at the specified position in the table.
The position in the table where the row will be deleted. 0 will delete the first row.
Number of rows to delete.
Inserts one or more columns before the specified position in the table.
The position in the table where the column will be inserted. 0 will insert the column at the leftmost. Any value larger than the number of rows in the table will insert a row at the bottom of the table.
Number of rows to insert.
Copy styles from the column to the left.
The inserted range
Deletes one or more columns at the specified position in the table.
The position in the table where the column will be deleted.
Number of rows to delete.
The deleted range
Sets differential formatting styles for the table header row border style.
Sets differential formatting styles for the tables row border style.
Gets the sort state of the table.
Sorts the data in the table according to the supplied
var options = new SortOptions();
options.SortBy.Column(0).ThenSortBy.Column(1, eSortDirection.Descending);
Sorts the data in the table according to the supplied action of
table.Sort(x => x.SortBy.Column(0).ThenSortBy.Column(1, eSortDirection.Descending);
An action with parameters for sorting
A collection of table objects
Create a table on the supplied range
The range address including header and total row
The name of the table. Must be unique
The table object
Delete the table at the specified index
The index
Clear the rage if set to true
Delete the table with the specified name
The name of the table to be deleted
Clear the rage if set to true
Delete the table
The table object
Clear the table range
Number of items in the collection
Get the table object from a range.
The range
The table. Null if no range matches
The table Index. Base 0.
Indexer
The name of the table
The table. Null if the table name is not found in the collection
Gets the enumerator for the collection
The enumerator
A table column
The column id
The position of the column
The name of the column
A string text in the total row
Build-in total row functions.
To set a custom Total row formula use the TotalsRowFormula property
Sets a custom Totals row Formula.
Be carefull with this property since it is not validated.
tbl.Columns[9].TotalsRowFormula = string.Format("SUM([{0}])",tbl.Columns[9].Name);
The named style for datacells in the column
Returns the slicer attached to a column.
If the column has multiple slicers, the first is returned.
Adds a slicer drawing connected to the column
The table slicer drawing object
Sets a calculated column Formula.
Be carefull with this property since it is not validated.
tbl.Columns[9].CalculatedColumnFormula = string.Format("SUM(MyDataTable[[#This Row],[{0}]])",tbl.Columns[9].Name); //Reference within the current row
tbl.Columns[9].CalculatedColumnFormula = string.Format("MyDataTable[[#Headers],[{0}]]",tbl.Columns[9].Name); //Reference to a column header
tbl.Columns[9].CalculatedColumnFormula = string.Format("MyDataTable[[#Totals],[{0}]]",tbl.Columns[9].Name); //Reference to a column total
If the calculated formula is an array formula.
This property will be set if the formula calculation evaluate the formula as an array formula.
See
If the is null or empty.
The containing the table column
A collection of table columns
A reference to the table object
Number of items in the collection
The column Index. Base 0.
Indexer
The name of the table
The table column. Null if the table name is not found in the collection
Adds one or more columns at the end of the table.
Number of columns to add.
The added range
Inserts one or more columns before the specified position in the table.
The position in the table where the column will be inserted. 0 will insert the column at the leftmost position. Any value larger than the number of rows in the table will insert a row at the end of the table.
Number of columns to insert.
The inserted range
Deletes one or more columns from the specified position in the table.
The position in the table where the column will be inserted. 0 will insert the column at the leftmost position. Any value larger than the number of rows in the table will insert a row at the end of the table.
Number of columns to insert.
The inserted range
Base class for handling differnetial style records for tables.
Style applied on the header range of a table.
Style applied on the data range of a table.
Style applied on the total row range of a table.
Returns true if the record is hidden by a page filter in the pivot table
The pivot table
The pivot cache records
The record index
Returns true if a record is hidden by a caption/date or numeric filter
An Item selection for a row or colummn field used as argument to the GetPivotData method to filter.
Constructor
The row/column field to filter
The value to filter on
Constructor
The row/column field to filter
The value to filter on
If a row/column field has one or multiple Subtotal Functions specified, you can access them here.
The row or column field.
The value to filter on.
If a row/column field has a subtotal subtotalFunction other that "Default" or "None", it can be specified in the criteria.
Where row fields end and colfields start in the key
Where row fields end and colfields start in the key
The scope of the pivot table conditional formatting rule
The conditional formatting is applied to the selected data fields.
The conditional formatting is applied to the selected PivotTable field intersections.
The conditional formatting is applied to the selected data fields.
Conditional Formatting Evaluation Type
The conditional formatting is not evaluated
The Top N conditional formatting is evaluated across the entire scope range.
The Top N conditional formatting is evaluated for each row§.
The Top N conditional formatting is evaluated for each column.
Build-in table row functions
Average
Count
Count, numbers
Max value
Minimum value
The product
None
Standard deviation
Standard deviation of a population,
Sum
Variation
The variance of a population
Data grouping
Group by years
Group by quarters
Group by months
Group by days
Group by hours
Group by minutes
Group by seconds
The item type for a pivot table field
The pivot item represents data.
The pivot item represents an "average" aggregate function.
The pivot item represents a blank line.
The pivot item represents custom the "count" aggregate function.
The pivot item represents custom the "count numbers" aggregate.
The pivot item represents the default type for this PivotTable.
The default pivot item type is the "total" aggregate function.
The pivot items represents the grand total line.
The pivot item represents the "maximum" aggregate function.
The pivot item represents the "minimum" aggregate function.
The pivot item represents the "product" function.
The pivot item represents the "standard deviation" aggregate function.
The pivot item represents the "standard deviation population" aggregate function.
The pivot item represents the "sum" aggregate value.
The pivot item represents the "variance" aggregate value.
The pivot item represents the "variance population" aggregate value.
Defines the pivot area affected by a style
Refers to the whole pivot table
Refers to a field button
Refers to data in the data area.
Refers to no pivot area
Refers to a header or item
Refers to the blank cells at the top-left(LTR sheets) or bottom-right(RTL sheets) of the pivot table.
Refers to the blank cells at the top of the pivot table, on its trailing edge.
Defines the axis for a PivotTable
None
Column axis
Page axis (Include Count Filter)
Row axis
Values axis
Defines the axis for a pivot table
No axis defined
Defines the column axis
Defines the page axis
Defines the row axis
Defines the values axis
Defines a pivot table caption filter type
A caption filter - Begins With
A caption filter - Between
A caption filter - Contains
A caption filter - Ends With
A caption filter - Equal
A caption filter - Greater Than
A caption filter - Greater Than Or Equal
A caption filter - Less Than
A caption filter - Less Than Or Equal
A caption filter - Not Begins With
A caption filter - Not Between
A caption filter - Not Contains
A caption filter - Not Ends With
A caption filter - Not Equal
Defines a pivot table caption period type
A date filter - Last Month
A date filter - Last Quarter
A date filter - Last Week
A date filter - Last Year
A date filter - Januari
A date filter - Februari
A date filter - March
A date filter - April
A date filter - May
A date filter - June
A date filter - July
A date filter - August
A date filter - September
A date filter - October
A date filter - November
A date filter - December
A date filter - Next Month
A date filter - Next Quarter
A date filter - Next Week
A date filter - Next Year
A date filter - The First Quarter
A date filter - The Second Quarter
A date filter - The Third Quarter
A date filter - The Forth Quarter
A date filter - This Month
A date filter - This Quarter
A date filter - This Week
A date filter - This Year
A date filter - Today
A date filter - Tomorrow
A date filter - Year to date
A date filter - Yesterday
Defines a pivot table date value filter type
A date filter - Between
A date filter - Equal
A date filter - Newer Than
A date filter - Newer Than Or Equal
A date filter - Not Between
A date filter - Not Equal
A date filter - Older Than
A date filter - Older Than Or Equal
Defines a pivot table filter type
A caption filter - Begins With
A caption filter - Between
A caption filter - Contains
A caption filter - Ends With
A caption filter - Equal
A caption filter - Greater Than
A caption filter - Greater Than Or Equal
A caption filter - Less Than
A caption filter - Less Than Or Equal
A caption filter - Not Begins With
A caption filter - Not Between
A caption filter - Not Contains
A caption filter - Not Ends With
A caption filter - Not Equal
A date filter - Between
A date filter - Equal
A date filter - Newer Than
A date filter - Newer Than Or Equal
A date filter - Not Between
A date filter - Not Equal
A date filter - Older Than
A date filter - Older Than Or Equal
A date filter - Last Month
A date filter - Last Quarter
A date filter - Last Week
A date filter - Last Year
A date filter - Januari
A date filter - Februari
A date filter - March
A date filter - April
A date filter - May
A date filter - June
A date filter - July
A date filter - August
A date filter - September
A date filter - October
A date filter - November
A date filter - December
A date filter - Next Month
A date filter - Next Quarter
A date filter - Next Week
A date filter - Next Year
A date filter - The First Quarter
A date filter - The Second Quarter
A date filter - The Third Quarter
A date filter - The Forth Quarter
A date filter - This Month
A date filter - This Quarter
A date filter - This Week
A date filter - This Year
A date filter - Today
A date filter - Tomorrow
A date filter - Year to date
A date filter - Yesterday
Indicates that the filter is unknown
A numeric or string filter - Value Between
A numeric or string filter - Equal
A numeric or string filter - GreaterThan
A numeric or string filter - Greater Than Or Equal
A numeric or string filter - Less Than
A numeric or string filter - Less Than Or Equal
A numeric or string filter - Not Between
A numeric or string filter - Not Equal
A top/bottom filter - Count
A top/bottom filter - Sum
A top/bottom filter - Percent
Defines a pivot table top 10 filter type
A top/bottom filter - Count
A top/bottom filter - Sum
A top/bottom filter - Percent
Defines a pivot table value filter type for numbers and strings
A numeric or string filter - Value Between
A numeric or string filter - Equal
A numeric or string filter - GreaterThan
A numeric or string filter - Greater Than Or Equal
A numeric or string filter - Less Than
A numeric or string filter - Less Than Or Equal
A numeric or string filter - Not Between
A numeric or string filter - Not Equal
The data formats for a field in the PivotTable
The field is shown as the "difference from" a value.
The field is shown as the index.
((Cell Value) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total))
The field is shown as its normal datatype.
The field is show as the percentage of a value
The field is shown as the percentage difference from a value.
The field is shown as the percentage of the column.
The field is shown as the percentage of the row
The field is shown as the percentage of the total
The field is shown as the running total in the the table
The field is shown as the percentage of the parent row total
The field is shown as the percentage of the parent column total
The field is shown as the percentage of the parent total
The field is shown as the rank ascending.
Lists the smallest item in the field as 1, and each larger value with a higher rank value.
The field is shown as the rank descending.
Lists the largest item in the field as 1, and each smaller value with a higher rank value.
The field is shown as the percentage of the running total
Sorting
No sorting
Sort ascending
Sort descending
Source type for a pivottable
The cache contains data that consolidates ranges
The cache contains data from an external data source
The cache contains a scenario summary report
The cache contains worksheet data
Built-in subtotal functions
None
Count cells that are numbers.
Count cells that are not empty.
Average
Default, total
Minimum
Maximum
Product
Standard deviation
Standard deviation of a population
Summary
Variation
Variation of a population
Cache definition. This class defines the source data. Note that one cache definition can be shared between many pivot tables.
Refreshes the pivot tables cache.
Provides access to the XML data representing the cache definition in the package.
The package internal URI to the pivottable cache definition Xml Document.
Referece to the PivotTable object
The source data range when the pivottable has a worksheet datasource.
The number of columns in the range must be intact if this property is changed.
The range must be in the same workbook as the pivottable.
If Excel will save the source data with the pivot table.
Type of source data
Represents a null value in a pivot table caches shared items list.
Check equals. Always true
The first object
The second object
Check equals with another object
The object
True if the obj is null
The hash value for the object
The hash value for the object
Return the string representation of the pivot null value
An empty string
An Excel Pivottable
Represents a null value in a pivot table caches shared items list.
Add a new pivottable
The worksheet
the address of the pivottable
The pivot table cache
Add a new pivottable
The worksheet
the address of the pivottable
The address of the Source data
Individual styles for the pivot table.
Provides access to the XML data representing the pivottable in the package.
The package internal URI to the pivottable Xml Document.
Name of the pivottable object in Excel
Reference to the pivot table cache definition object
True if the pivot table has been calculated.
Calculates the pivot table.
Also see and
If the pivot cache should be refreshed from the source data, before calculating the pivot table.
Returns the calculated grand total for the pivot table. This function works similar to the GetPivotData function used in formulas.
If the pivot table is created in EPPlus without refreshing the cache, the cache will be created.
Please note the any source data containing formulas must be calculated before the pivot table is calculated.
The name of the data field. If a data field with the name does exist in the table, a #REF! error is returned-
The calculated value
Returns a calculated value for a row or column field. This function works similar to the GetPivotData function.
If a row or column field is omitted, the subtotal for that field is retrieved.
If the pivot table is not calculated a calculation will be performed without refreshing the pivot cache.
If the pivot table is created in EPPlus without refreshing the cache, the cache will be created.
Please note the any source data containing formulas must be calculated before the pivot table is calculated.
A list of criterias to determin which value to retrieve. If the fieldItemSelection does not exist in the pivot tabvle a #REF! error is returned.
The name of the data field. If a data field with the name does exist in the table, a #REF! error is returned-
The calculated value
Access to the calculated data when the pivot table has been calculated.
The worksheet where the pivottable is located
The location of the pivot table
If multiple datafields are displayed in the row area or the column area
The position of the values in the row- or column- fields list. Position is dependent on .
If DataOnRows is true then the position is within the collection,
a value of false the position is within the collection.
A negative value or a value out of range of the add the "Σ values" field to the end of the collection.
if true apply legacy table autoformat number format properties.
If true apply legacy table autoformat border properties
If true apply legacy table autoformat font properties
If true apply legacy table autoformat pattern properties
If true apply legacy table autoformat width/height properties.
Show member property information
Show the drill indicators
If the user is prevented from drilling down on a PivotItem or aggregate value
Show the drill down buttons
If the tooltips should be displayed for PivotTable data cells.
If the row and column titles from the PivotTable should be printed.
If the row and column titles from the PivotTable should be printed.
If the grand totals should be displayed for the PivotTable columns
If the grand totals should be displayed for the PivotTable rows
If the drill indicators expand collapse buttons should be printed.
Indicates whether to show error messages in cells.
The string to be displayed in cells that contain errors.
Specifies the name of the value area field header in the PivotTable.
This caption is shown when the PivotTable when two or more fields are in the values area.
Show field headers
The number of page fields to display before starting another row or column
A boolean that indicates whether legacy auto formatting has been applied to the PivotTable view
A boolean that indicates if the in-grid drop zones should be displayed at runtime, and if classic layout is applied
The indentation increment for compact axis and can be used to set the Report Layout to Compact Form
A boolean that indicates whether data fields in the PivotTable should be displayed in outline form
A boolean that indicates whether new fields should have their outline flag set to true
A boolean that indicates if the fields of a PivotTable can have multiple filters set on them
A boolean that indicates if new fields should have their compact flag set to true
Sets all pivot table fields property to the value supplied.
The the value for the Compact property.
A boolean that indicates if the field next to the data field in the PivotTable should be displayed in the same column of the spreadsheet.
Specifies the string to be displayed for grand totals.
The text to be displayed in row header in compact mode.
The text to be displayed in column header in compact mode.
The text to be displayed in cells with no value
Filters applied to the pivot table
The first row of the PivotTable header, relative to the top left cell in the ref value
The first column of the PivotTable data, relative to the top left cell in the range
The first column of the PivotTable data, relative to the top left cell in the range.
The fields in the table
Row label fields
Column label fields
Value fields
Report filter fields
Pivot style name. Used for custom styles
Whether to show column headers for the pivot table.
Whether to show column stripe formatting for the pivot table.
Whether to show the last column for the pivot table.
Whether to show row headers for the pivot table.
Whether to show row stripe formatting for the pivot table.
The table style. If this property is Custom, the style from the StyleName propery is used.
The pivot table style. If this property is Custom, the style from the StyleName propery is used.
If the pivot tables value row is visible or not.
This property only applies when is set to false.
A collection of Conditional Formatting's to apply to the pivot table.
A pivot tables cache field
The index in the collection of the pivot field
The name for the field
A list of unique items for the field
A list of group items, if the field has grouping.
The type of date grouping
Grouping proprerties, if the field has grouping
The number format for the field
The formula for cache field.
The formula for the calculated field.
Note: In formulas you create for calculated fields or calculated items, you can use operators and expressions as you do in other worksheet formulas.
You can use constants and refer to data from the pivot table, but you cannot use cell references or defined names.You cannot use worksheet functions that require cell references or defined names as arguments, and you cannot use array functions.
Removes milliseconds from TimeSpan and DateTime values and set the value to if the value is null
The value
The new value
Represents a selection of a row or column field to retreive the calculated value from a pivot table.
Specifies which value to use for a field.
The name of the field
The value
A new to select other row or column field values or fetch the calulated value in a fluent way.
Specifies which value to use for a field.
The name of the field
The value
Get the value for the current field selection.
Get the value for the current field selection.
The index for the date field in the collection
The value from the pivot table. If data field does not exist of the selected fields does not match any part of the pivot table a #REF! error is retuned.
A collection of pivottable objects
Create a pivottable on the supplied range
The range address including header and total row
The Source data range address
The name of the pivottable. Must be unique
The pivottable object
Create a pivottable on the supplied range
The range address including header and total row
The source table
The name of the pivottable. Must be unique
The pivottable object
Create a pivottable on the supplied range
The range address including header and total row
A pivot table cache shared with another pivot table
The name of the pivottable. Must be unique
The pivottable object
Number of items in the collection
The pivottable Index. Base 0.
Pivottabes accesed by name
The name of the pivottable
The Pivotable. Null if the no match is found
Gets the enumerator of the collection
The enumerator
Delete the pivottable with the supplied name
The name of the pivottable
Clear the table range
Delete the pivot table at the specified index
The index in the PivotTable collection
Clear the table range
Delete the supplied pivot table
The PivotTable to remove from the collection
Clear the table range
Calculate all pivot tables in the collection.
Also see and
If the cache should be refreshed.
A pivot table data field
The field
The index of the datafield
The name of the datafield
Field index. Reference to the field collection
The index to the base item when the ShowDataAs calculation is in use
Number format id.
The number format for the data field
Type of aggregate function
Represents a pivot fields Show As properties.
Collection class for data fields in a Pivottable
Add a new datafield
The field
The new datafield
Returns the data field with the name supplied.
The name of the field or the cache field
THe data field
Remove a datafield
The data field to remove
Compares the item to the previous or next item.
The Previous item
The Next item
Represents a pivot fields Show As properties.
Sets the show data as to type Normal. This removes the Show data as setting.
Sets the show data as to type Percent Of Total
Sets the show data as to type Percent Of Row
Sets the show data as to type Percent Of Column
Sets the show data as to type Percent
The base field to use
The index of the item to use within the collection of the base field
Sets the show data as to type Percent
The base field to use
The previous or next field
Sets the show data as to type Percent Of Parent
The base field to use
Sets the show data as to type Index
Sets the show data as to type Running Total
The base field to use
Sets the show data as to type Difference
The base field to use
The index of the item to use within the collection of the base field
Sets the show data as to type Difference
The base field to use
The previous or next field
Sets the show data as to type Percent Of Total
The base field to use
The index of the item to use within the collection of the base field
Sets the show data as to type Percent Of Total
The base field to use
The previous or next field
Sets the show data as to type Percent Of Parent Row
Sets the show data as to type Percent Of Parent Column
Sets the show data as to type Percent Of Running Total
Sets the show data as to type Rank Ascending
The base field to use
Sets the show data as to type Rank Descending
The base field to use
The value of the "Show Data As" setting
A pivot table field.
The index of the pivot table field
The base line index of the pivot table field
Name of the field
Compact mode
A boolean that indicates whether the items in this field should be shown in Outline form
A boolean that indicates whether a blank row should be inserted after each item.
A boolean that indicates whether the item labels should repeat or not.
The custom text that is displayed for the subtotals label
Indicates whether the field can have multiple items selected in the page field
Indicates whether to show all items for this field
Indicates whether to hide drop down buttons on PivotField headers
Indicates whether this hierarchy is omitted from the field list
Indicates whether to show the property as a member caption
Indicates whether to show the member property value in a PivotTable cell
Indicates whether to show the member property value in a tooltip on the appropriate PivotTable cells
The type of sort that is applied to this field
Set auto sort on a data field for this field.
The data field to sort on
Sort ascending or descending
Remove auto sort and set the property to null
Auto sort for a field. Sort is set on a data field for a row/column field.
Use to set auto sort
Use to remove auto sort and set this property to null
A boolean that indicates whether manual filter is in inclusive mode
Enumeration of the different subtotal operations that can be applied to page, row or column fields
Type of axis
If the field is a row field
If the field is a column field
If the field is a datafield
If the field is a page field.
Page field settings
Date group by
Grouping settings.
Null if the field has no grouping otherwise ExcelPivotTableFieldDateGroup or ExcelPivotTableFieldNumericGroup.
The numberformat to use for the column
Pivottable field Items. Used for grouping.
A reference to the cache for the pivot table field.
Add numberic grouping to the field
Start value
End value
Interval
Will add a slicer to the pivot table field
The Slicer/>
A slicer attached to the pivot table field.
If the field has multiple slicers attached, the first slicer will be returned.
Add a date grouping on this field.
Group by
Add a date grouping on this field.
Group by
Fixed start date. Use DateTime.MinValue for auto
Fixed end date. Use DateTime.MaxValue for auto
Add a date grouping on this field.
Number of days when grouping on days
Fixed start date. Use DateTime.MinValue for auto
Fixed end date. Use DateTime.MaxValue for auto
Filters used on the pivot table field.
Allow as column field?
Allow as page row?
Allow as page field?
A collection of pivot table fields
Indexer by name
The name
The pivot table field
Returns the date group field.
The type of grouping
The matching field. If none is found null is returned
Returns the numeric group field.
The matching field. If none is found null is returned
Adds a calculated field to the underlaying pivot table cache.
The unique name of the field
The formula for the calculated field.
Note: In formulas you create for calculated fields or calculated items, you can use operators and expressions as you do in other worksheet formulas. You can use constants and refer to data from the pivot table, but you cannot use cell references or defined names.You cannot use worksheet functions that require cell references or defined names as arguments, and you cannot use array functions.
The new calculated field
It the object exists in the cache
The object to check for existance
Get the item with the value supplied. If the value does not exist, null is returned.
The value
The pivot table field
Get the index of the item with the value supplied. If the value does not exist, -1 is returned.
The value
The index of the item
Set Hidden to false for all items in the collection
Set the ShowDetails for all items.
The value of true is set all items to be expanded. The value of false set all items to be collapsed
Hide all items except the item at the supplied index
Refreshes the data of the cache field
Base collection class for pivottable fields
Gets the enumerator of the collection
The enumerator
Number of items in the collection
Indexer for the collection
The index
The pivot table field
Returns the zero-based index of the item.
The item
the zero-based index of the item in the list
A date group
How to group the date field
Auto detect start date
Auto detect end date
Start date for the grouping
End date for the grouping
Intervall if for day grouping
Base class for pivot table field groups
The index of the base field for this group field
The index of the parent field from this group field
A pivot table field Item. Used for grouping.
The custom text of the item. Unique values only
The value of the item
A flag indicating if the item is hidden
A flag indicating if the items is expanded or collapsed.
A pivot table field numeric grouping
Start value
End value
Interval
A page / report filter field
The display name of the hierarchy.
The Name of the field
The selected item. A negative value means that no value is selected.
See also
The index of the OLAP hierarchy to which this page field belongs
Collection class for row and column fields in a Pivottable
Add a new row/column field
The field
The new field
Insert a new row/column field
The field
The position to insert the field
The new field
Remove a field
Remove a field at a specific position
A collection of pivot filters for a pivot table field
Adds a caption (label) filter for a pivot tabel field
The type of pivot table caption filter
Value 1
Value 2. Set to null, if not used
Adds a date filter for a pivot table field
The type of pivot table filter.
Value 1
Value 2. Set to null, if not used
The pivot table filter
Thrown if value is between and is null
Adds a date period filter for a pivot table field.
The type of field.
The pivot table filter
Adds a pivot table value filter.
The type of value filter
The data field to apply the filter to
Value 1
Value 2. Used with and
The pivot table filter
If the data field is not present in the pivot table.
If value2 is not set when type is set to between
Adds a pivot table value filter.
The type of value filter
The index of the to apply the filter to.
Value 1
Value 2. Used with and
The pivot table filter
If the data field is not present in the pivot table.
If value2 is not set when type is set to between
Adds a top 10 filter to the field
The top-10 filter type
The datafield within the pivot table
The top or bottom value to relate to
Top or bottom. true is Top, false is Bottom
Adds a top 10 filter to the field
The top-10 filter type
The index to the data field within the pivot tables DataField collection
The top or bottom value to relate to
Top or bottom. true is Top, false is Bottom
Defines a pivot table filter
The id
The name of the pivot filter
The description of the pivot filter
Handle caption(String) filters and the unknown filter type. This is filter enum values below 100.
Handle date filters. This is filter enum values below 100.
The type of pivot filter
The evaluation order of the pivot filter
The index to the row/column field the filter is applied on
The index to the data field a value field is evaluated on.
The valueOrIndex 1 to compare the filter to
The valueOrIndex 2 to compare the filter to
The string valueOrIndex 1 used by caption filters.
The string valueOrIndex 2 used by caption filters.
The base collection for pivot table filters
Reloads the collection from the xml.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Number of items in the collection
The indexer for the collection
The index
A collection of pivot filters for a pivot table
Defines sorting for a pivot table area within a pivot table.
Defines an area for conditional formatting within a pivot table.
A collection of pivot areas used for conditional formatting
Adds a new area for the one or more data fields
The data field(s) where the conditional formatting should be applied. If no fields are supplied all the pivot tables data fields will be added to the area
The pivot area for the conditional formatting
/// Removes the the from the collection
The item to remove.
Removes the at the
The zero-based index in the collction to remove
Defines a pivot table area of selection used for styling.
A collection of conditions for the conditional formattings. Conditions can be set for specific row-, column- or data fields. Specify labels, data grand totals and more.
Access to the style property for the pivot area
The priority of the pivot table conditional formatting rule that should be matched in the worksheet.
If this value differs from the priority, the later will be used when saved.
The condition type of the pivot table conditional formatting rule. Default is None.
This property only apply to condional formattings for above/below -average, -stdev amd top or bottom.
If setting this property to Row or Column when having an unsupported conditional formatting rule.
The scope of the pivot table conditional formatting rule. Default is Selection.
A collection of pivot areas used for styling a pivot table.
Adds a conditional formatting pivot area for the pivot tables data field(cf).
Note that only conditional formattings for data is support. Conditional formattings for Lables, data buttons and other pivot areas must be added using the collection.
The type of conditional formatting rule
The data field(cf) in the pivot table to apply the rule. If no data field is provided, all data field in the collection will be added to the area.The area will be added to the collection
The rule
Defines a pivot table area of selection used for different purposes.
Conditions for the pivot table. Conditions can be set for specific row-, column- or data fields. Specify labels, data grand totals and more.
The field referenced. -2 means refers to values.
Position of the field within the axis to which this rule applies.
If the pivot area referes to the "Σ Values" field in the column or row fields.
The pivot area type that affecting the selection.
The region of the PivotTable affected.
If the data values in the data area are included. Setting this property to true will set to false.
If the item labels are included. Setting this property to true will set to false.
If the row grand total is included
If the column grand total is included
If any indexes refers to fields or items in the pivot cache and not the view.
Indicating whether the pivot table area refers to an area that is in outline mode.
A address in A1C1 format that specifies a subset of the selection area. Points are relative to the top left of the selection area.
The first cell is referenced as A1. For example, B1:C1 reference the second and third column of the first row of the pivot area.
If collapsed levels/dimensions are considered subtotals
A collection of data fields used in a pivot area selection
The indexer
The zero-based index of the collection
Number of items in the collection
Adds the data field at the specific index
Adds a data field from the pivot table to the pivot area
Gets the enumerator
Gets the enumerator
A reference to a field in a pivot area
The pivot table field referenced
References to the pivot table cache or within the table.
Base class for pivot area references
If this field has selection. This property is used when the pivot table is in outline view. It is also used when both header and data cells have selection.
If the item is referred to by a relative reference rather than an absolute reference.
Whether the item is referred to by position rather than item index.
If the default subtotal is included in the filter.
If the Average aggregation function is included in the filter.
If the Count aggregation function is included in the filter.
If the CountA aggregation function is included in the filter.
If the Maximum aggregation function is included in the filter.
If the Minimum aggregation function is included in the filter.
If the Product aggregation function is included in the filter.
If the population standard deviation aggregation function is included in the filter.
If the standard deviation aggregation function is included in the filter.
If the sum aggregation function is included in the filter.
If the population variance aggregation function is included in the filter.
If the variance aggregation function is included in the filter.
A collection of pivot area references. A pivot area reference is a reference to a column, row field or a data field
Adds a pivot table field to the collection. The field is usually a column or row field
The column or row field
The pivot area reference
Adds a pivot table field to the collection. The field is usually a column or row field
The pivot table
The index of the pivot table field
A list of pivot item refernces
Adds the item at the index to the condition. The index referes to the pivot cache.
Index into the pivot cache items. Either the shared items or the group items
Adds a specific cache item to the condition. The value is matched against the values in the pivot cache, either the shared items or the group items.
The value to match against. Is matched agaist the cache values and must be matched with the same data type.
true if the value has been added, otherwise false
A reference to a pivot table value item
The index of the item in items of the pivot table field
The value of the item
Conditions for a pivot table area style.
Row and column fields that the conditions will apply to.
The data field that the conditions will apply too.
Updates the xml. Returns false if all conditions are deleted and the items should be removed.
Returns false if the items should be deleted.
Defines a pivot table area of selection used for styling.
Access to the style property for the pivot area
A collection of pivot areas used for styling a pivot table.
Adds a pivot area style for labels or data.
Adds a pivot area style for the top right cells of the pivot table, to the right of any filter button, if reading order i set to Left-To-Right.
Adds a style for the top right cells of the pivot table, to the right of any filter button, if reading order i set to Left-To-Right.
Offset address from the top-left cell to the right of any filter button. The top-left cell is refereced as A1. For example, B1:C1 will reference the second and third cell of the first row of the area. "null" will mean all cells
Adds a style for the top left cells of the pivot table, if reading order i set to Left-To-Right
Offset address from the left cell. The top-left cell is refereced as A1. For example, B1:C1 will reference the second and third cell of the first row of the area. "null" will mean all cells
Adds a style for the filter box.
The field with the box to style
Adds a pivot area style that affects the whole table.
The style object used to set the styles
Adds a pivot area style that affects all labels
The style object used to set the styles
Adds a pivot area style that affects all data cells
The style object used to set the styles
Adds a style for the labels of a pivot table
The pivot table field that style affects
Adds a style for the data area of a pivot table
Adds a style for filter boxes.
The axis for the field buttons
The zero-based index in the axis collection
Handles the pivot table cache.
Reference to the internal package part
Provides access to the XML data representing the cache definition in the package.
The package internal URI to the pivottable cache definition Xml Document.
This is the cache id from the workbook
This a second cache id used for newer items like slicers. EPPlus will set this id to the same as the cache id by default.
Represents a comment in a thread of ThreadedComments
Indicates whether the Text contains mentions. If so the
Mentions property will contain data about those mentions.
Address of the cell in the A1 format
The location of the threaded comment
Timestamp for when the comment was created
Unique id
Id of the who wrote the comment
Author of the comment
Id of the first comment in the thread
Text of the comment. To edit the text on an existing comment, use the EditText function.
Edit the Text of an existing comment
Edit the Text of an existing comment with mentions
A string with format placeholders - same as in string.Format. Index in these should correspond to an index in the array.
A params array of . Their DisplayName property will be used to replace the format placeholders.
Mentions in this comment. Will return null if no mentions exists.
This class represents an enumerable of s.
A reference to the worksheet object
Returns a by its index
Index in this collection
The at the requested
If the falls out of range
Returns a by its
Id of the requested
The requested
If the requested was not present.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Number of s
Removes all s in the collection
Returns a string that represents the current object.
A string that represents the current object.
This class represents a mention of a person in a
Constructor
Namespace manager of the
An representing the mention
Index in the s text where the mention starts
Length of the mention, value for @John Doe would be 9.
Id of this mention
Id of the mentioned
A collection of mentions that occors in a
Constructor
The Namespacemangager of the package
The representing the parent element of the collection
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Adds a mention
The to mention
Index of the first character of the mention in the text
Rebuilds the collection with the elements sorted by the property StartIndex.
Remove all mentions from the collection
Returns a string that represents the current object.
A string that represents the current object.
A person in the context of ThreadedComments.
Might refer to an , see property ProviderId.
Unique Id of the person
Display name of the person
See the documentation of the members of the enum and
Microsofts documentation at https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/6274371e-7c5c-46e3-b661-cbeb4abfe968
See the documentation of the members of the enum and
Microsofts documentation at https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/6274371e-7c5c-46e3-b661-cbeb4abfe968
Determines whether the specified objects are equal.
The first object to compare.
The second object to compare.
Returns a hash code for the specified object.
The for which a hash code is to be returned.
Returns a string that represents the current object.
A string that represents the current object.
Represents a collection of s in a workbook.
Constructor
The where the occurs
The xml document defining the threaded comments persons collection.
Number of s in the collection
Returns the by its index
The requested index
The at the requested index
Returns a by its id
The Id of the Person
A with the requested or null
Finds a that a certain criteria
The criterias
A matching
Finds a number of 's that matches a certain criteria.
The criterias
An enumerable of matching 's
Creates and adds a new to the workbooks list of persons. A unique Id for the person will be generated and set.
The userId will be the same as the and identityProvider will be set to
The display name of the added
Creates and adds a new to the workbooks list of persons. A unique Id for the person will be generated and set.
The display name of the added
A string representing the userId of the
The from which the originates
The added
Creates and adds a new to the workbooks list of persons
The display name of the added
A string representing the userId of the
The from which the originates
Id of the
The added
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Returns an enumerator that iterates through the collection.
An enumerator that can be used to iterate through the collection.
Removes a from the collection
Removes all persons from the collection
Returns a string that represents the current object.
A string that represents the current object.
Represents a thread of s in a cell on a worksheet. Contains functionality to add and modify these comments.
The address of the cell of the comment thread
A collection of comments in the thread.
The worksheet where this comment thread resides
The raw xml representing this comment thread.
When this method is called the legacy comment representing the thread will be rebuilt.
Adds a to the thread
Id of the author, see
Text of the comment
Adds a with mentions in the text to the thread.
Id of the autor
A string with format placeholders - same as in string.Format. Index in these should correspond to an index in the array.
A params array of . Their DisplayName property will be used to replace the format placeholders.
The added
Removes a from the thread.
The comment to remove
true if the comment was removed, otherwise false
Closes the thread, only the author can re-open it.
If true the thread is resolved, i.e. closed for edits or further comments.
Re-opens a resolved thread.
Deletes all s in the thread and the legacy in the cell.
Returns a string that represents the current object.
A string that represents the current object.
Accessor for s on a
A collection of persons referenced by the threaded comments.
An enumerable of the existing s on the worksheet
Number of s on the worksheet
The raw xml for the threaded comments
Adds a new to the cell.
Thrown if there was an existing in the cell.
The new, empty
Adds a new to the cell.
The cell address
The new, empty
Thrown if there was an existing in the cell.
If a note/comment exist in the cell
Returns a for the requested .
The requested cell address in A1 format
An existing or null if no thread exists
Returns a for the requested .
The requested cell address in A1 format
An existing or null if no thread exists
Returns a for the requested .
The index in the collection
An existing or null if no thread exists
Removes the index position in the collection
The index for the threaded comment to be removed
Removes the supplied
An existing in the worksheet
Shifts all comments based on their address and the location of inserted rows and columns.
The start row.
The start column.
The number of rows to insert.
The number of columns to insert.
If the delete is in a range, this is the end row
If the delete is in a range, this the end column
Shifts all comments based on their address and the location of inserted rows and columns.
The start row
The start column
The number of rows to insert
The number of columns to insert
If the insert is in a range, this is the end row
If the insert is in a range, this the end column
Returns a string that represents the current object.
A string that represents the current object.
This enum defines the Identity providers for
as described here: https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/6274371e-7c5c-46e3-b661-cbeb4abfe968
No provider, Person's userId should be a name
ActiveDirectory, Person's userId should be an ActiveDirectory Security Identifier (SID) as specified here:
https://docs.microsoft.com/en-us/openspecs/windows_protocols/MS-DTYP/cca27429-5689-4a16-b2b4-9325d93e4ba2
Windows Live, Person's userId should be a 64-bit signed decimal that uniquely identifies a user on Windows Live
Office 365. The Person's userId should be a string that uniquely identifies a user. It SHOULD be comprised
of three individual values separated by a "::" delimiter.
People Picker, The Persons userId should be an email address provided by People Picker.
Inserts mentions in the comment text and in the comment
A string with format placeholders with indexes, simlar to string.Format
s to mention
A utility to work with Excel addresses
Parse an entire column selection, e.g A:A
The entire address
Add row number to entire column range
The address
The full column range
Extension methods for guarding
Throws an ArgumentNullException if argument is null
Argument type
Argument to check
parameter/argument name
Throws an if the string argument is null or empty
Argument to check
parameter/argument name
Throws an ArgumentOutOfRangeException if the value of the argument is out of the supplied range
Type implementing
The argument to check
Min value of the supplied range
Max value of the supplied range
parameter/argument name
Encode to XML (special characteres: ' " > < &)
The root storage part of the compound document.
Directories in the order they are saved.
Reads and writes a compound documents.
Read spec here https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-CFB/[MS-CFB].pdf
Verifies that the header is correct.
The file
Verifies that the header is correct.
The file
The cancellation token
Verifies that the header is correct.
The memory stream
The cancellation token
0=Red
1=Black
Type of object
0x00 - Unknown or unallocated
0x01 - Storage Object
0x02 - Stream Object
0x05 - Root Storage Object
Compare length first, then sort by name in upper invariant
The other item
Tries to parse a double from the specified which is expected to be a string value.
The string value.
The double value parsed from the specified .
Other than Current culture
True if could be parsed to a double; otherwise, false.
Tries to parse a boolean value from the specificed .
The value to check for boolean-ness.
The boolean value parsed from the specified .
True if could be parsed
Tries to parse an int value from the specificed .
The value to check for boolean-ness.
The boolean value parsed from the specified .
True if could be parsed
Tries to parse a from the specified which is expected to be a string value.
The string value.
The double value parsed from the specified .
True if could be parsed to a double; otherwise, false.
Convert an object value to a double
Return NaN if invalid double otherwise 0
Return true if preserve space attribute is set.
Return true if preserve space attribute is set.
Return true if preserve space attribute is set.
Convert cell value to desired type, including nullable structs.
When converting blank string to nullable struct (e.g. ' ' to int?) null is returned.
When attempted conversion fails exception is passed through.
The type to convert to.
The converted to .
If input is string, parsing is performed for output types of DateTime and TimeSpan, which if fails throws .
Another special case for output types of DateTime and TimeSpan is when input is double, in which case
is used for conversion. This special case does not work through other types convertible to double (e.g. integer or string with number).
In all other cases 'direct' conversion is performed.
is string and its format is invalid for conversion (parsing fails)
is not string and direct conversion fails
Handles the issue with Excel having the incorrect values before 1900-03-01. Excel has 1900-02-29 as a valid value, but it does not exists in the calendar. Dates between 1900-02-28 and 1900-01-01 shuld be subtracted added 1 to the value. 0 in Excel is 1900-01-00 which is not valid in .NET.
Returns the enum value with first char lower case
An argument
Argument Type
Value of the argument
Memmory settings for RecyclableMemoryStream handling
The memory manager used, if RecyclableMemoryStream are used.
If true RecyclableMemoryStream's will be used to handle MemoryStreams. Default.
If false normal MemoryStream will be used.
Handles the Recyclable Memory stream for supported and unsupported target frameworks.
Sets the RecyclableMemorytreamsManager to manage pools
The memory manager
Get a new memory stream.
A MemoryStream
Get a new memory stream initiated with a byte-array
A MemoryStream
Get a new memory stream initiated with a byte-array
The initial size of the internal array
A MemoryStream
Utility for validation in functions.
Represent an argument to the function where the validation is implemented.
The argument to validate
Class for handling translation between ExcelAddresses and sqref addresses.
Transforms an address to a valid sqRef address.
The address to transform
A valid SqRef address
Transforms an sqRef address into a excel address
The address to transform
A valid excel address
Copies the input stream to the output stream.
The input stream.
The output stream.
Copies the input stream to the output stream.
The input stream.
The output stream.
The cancellation token
Provides functionality for analyzing the properties of a type.
The type to analyze
Constructor
The type to analyze
Returns true if the type to analyze is numeric.
Returns true if the type to analyze is nullable.
Returns true if the type to analyze equalse the type.
Returns true if the type to analyze equalse the type.
Compression using a run length encoding algorithm.
See MS-OVBA Section 2.4
Byte array to decompress
Decompression using a run length encoding algorithm.
See MS-OVBA Section 2.4
Byte array to decompress
Read file until a tag in tagName is found or EOF.
This requires more careful consideration than when specifing depth.
As it will exit on endnodes and continue directly to end of file if nothing is found.
Handle to xml to read data from
The node
Array of tags to stop at in the order they should appear in the xml
false if EOF or found end tag. True if found tag of element type
This list of strings is taken from [MS-OVBA] v20220517, 2.4.2.5 V3 Content Normalized Data
This is an implementation of the meta code described in
[MS-OVBA] v20220517, 2.4.2.5 V3 Content Normalized Data
See 2.4.2.6 Project Normalized Data for meta code
Signature version settings.
A boolean indicating if a signature for the VBA project will be created when the package is saved.
Default is true
The verifyer
The hash algorithm used.
Hash algorithms for usage when signing VBA
MD5 hash algorithm
SHA1 hash algorithm
SHA256 hash algorithm
SHA384 hash algorithm
SHA512 hash algorithm
To determine if the attribute uses double quotes around the value
A string
Not a string
Type of VBA module
A Workbook or Worksheet objects
A Module
A Class
Designer, typically a user form
Type of system where the VBA project was created.
Windows 16-bit
Windows 32-bit
Mac
Windows 64-bit
Hash algorithm used for signing vba projects.
Specifies that the MD5 algorithm, as defined by RFC 1319, shall be used.
Specifies that the SHA-1 algorithm, as defined by ISO/IEC 10118-3:2004 shall be used.
Specifies that the SHA-256 algorithm, as defined by ISO/IEC10118-3:2004 shall be used.
Specifies that the SHA-384 algorithm, as defined by ISO/IEC 10118-3:2004 shall be used.
Specifies that the SHA-512 algorithm, as defined by ISO/IEC10118-3:2004 shall be used.
Base class for VBA collections
A list of vba objects
Gets the enumerator for the collection
The enumerator
Indexer
Name
Indexer
Position
Number of items in the collection
If a specific name exists in the collection
The name
True if the name exists
Removes the item
Removes the item at the specified index
THe index
A VBA code module.
The name of the module
Module name unicode
A description of the module
The code without any module level attributes.
Can contain function level attributes.
A reference to the helpfile
Module level attributes.
Type of module
If the module is readonly
If the module is private
Converts the object to a string
The name of the VBA module
A VBA modual attribute
The name of the attribute
The datatype. Determine if the attribute uses double quotes around the value.
The value of the attribute without any double quotes.
Converts the object to a string
The name of the VBA module attribute
A collection of the module level attributes
Collection class for VBA modules
Adds a new VBA Module
The name of the module
The module object
Adds a new VBA class
The name of the class
Private or Public not createble
The class object
Represents the VBA project part of the package
System kind. Default Win32.
The compatible version for the VBA project. If null, this record is not written.
Name of the project
A description of the project
A helpfile
Secondary helpfile
Context if refering the helpfile
Conditional compilation constants
Codepage for encoding. Default is current regional setting.
Project references
Code Modules (Modules, classes, designer code)
The digital signature
VBA protection
2.4.3.3 Decryption
Byte hex string
The decrypted value
2.4.3.2 Encryption
Byte hex string
MS-OVBA 2.3.4.1
MS-OVBA 2.3.4.1
Create a new VBA Project
Remove the project from the package
The name of the project
Returns the name of the project
Vba security properties
If access to the VBA project was restricted by the user
If access to the VBA project was restricted by the VBA host application
If access to the VBA project was restricted by the VBA project editor
if the VBA project is visible.
Password protect the VBA project.
An empty string or null will remove the password protection
The password
A VBA reference
Constructor.
Defaults ReferenceRecordID to 0xD
The reference record ID. See MS-OVBA documentation for more info.
The reference record ID. See MS-OVBA documentation for more info.
The name of the reference
LibID
For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
A string representation of the object (the Name)
A collection of the vba projects references
Adds a new reference
The reference object
A reference to a twiddled type library
Constructor.
Sets ReferenceRecordID to 0x2F
LibIdExternal
For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
This corresponds to LibIdExtended in the documentation.
LibIdExtended
For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
LibIdTwiddled
For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
A GUID that specifies the Automation type library the extended type library was generated from.
A reference to an external VBA project
Constructor.
Sets ReferenceRecordID to 0x0E
LibIdRelative
For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
Major version of the referenced VBA project
Minor version of the referenced VBA project
The VBA project's code signature properties
The certificate to sign the VBA project.
This certificate must have a private key.
There is no validation that the certificate is valid for codesigning, so make sure it's valid to sign Excel files (Excel 2010 is more strict that prior versions).
The verifier (legacy format)
Settings for the legacy signing.
Settings for the agile vba signing.
The agile signature adds a hash that is calculated for user forms data in the vba project (designer streams).
Settings for the V3 vba signing.
The V3 signature includes more coverage for data in the dir and project stream in the hash, not covered by the legacy and agile signatures.
Returns the position in the xml document for an element. Either returns the position of the start element or the end element.
The xml to search
The element
If the position before the start element is returned. If false the end of the end element is returned.
The index position to start from
The position of the element in the input xml
Returns the position of the last instance of an element in the xml document. Either returns the position of the start element or the end element.
The xml to search
The element
The namespace prefix, if any
If the position before the start element is returned. If false the end of the end element is returned.
The index
The position of the element in the input xml
Returns the position of the last instance of an element in the xml document. Either returns the position of the start element or the end element.
The xml to search
The element
If the position before the start element is returned. If false the end of the end element is returned.
The index
The position of the element in the input xml
Abstract helper class containing functionality to work with XML inside the package.
Schema order list
Adds a new array to the end of SchemaNodeOrder
The order to start from
The new items
The new order
Adds a new array to the end of SchemaNodeOrder
The order to start from
The new items
Positions that defines levels in the xpath
Create the node path. Nodes are inserted according to the Schema node order
The path to be created
Insert as first child
Always add a new item at the last level.
Exit if after this named node has been created
Options to insert a node in the XmlDocument
Insert as first node of "topNode"
Insert as the last child of "topNode"
Insert after the "referenceNode"
Insert before the "referenceNode"
Use the Schema List to insert in the right order. If the Schema list
is null or empty, consider "Last" as the selected option
Create a complex node. Insert the node according to SchemaOrder
using the TopNode as the parent
Create a complex node. Insert the node according to the
using the as the parent
Creates complex XML nodes
1. "d:conditionalFormatting"
1.1. Creates/find the first "conditionalFormatting" node
2. "d:conditionalFormatting/@sqref"
2.1. Creates/find the first "conditionalFormatting" node
2.2. Creates (if not exists) the @sqref attribute
3. "d:conditionalFormatting/@id='7'/@sqref='A9:B99'"
3.1. Creates/find the first "conditionalFormatting" node
3.2. Creates/update its @id attribute to "7"
3.3. Creates/update its @sqref attribute to "A9:B99"
4. "d:conditionalFormatting[@id='7']/@sqref='X1:X5'"
4.1. Creates/find the first "conditionalFormatting" node with @id=7
4.2. Creates/update its @sqref attribute to "X1:X5"
5. "d:conditionalFormatting[@id='7']/@id='8'/@sqref='X1:X5'/d:cfRule/@id='AB'"
5.1. Creates/find the first "conditionalFormatting" node with @id=7
5.2. Set its @id attribute to "8"
5.2. Creates/update its @sqref attribute and set it to "X1:X5"
5.3. Creates/find the first "cfRule" node (inside the node)
5.4. Creates/update its @id attribute to "AB"
6. "d:cfRule/@id=''"
6.1. Creates/find the first "cfRule" node
6.1. Remove the @id attribute
The last node creates/found
return Prepend node
name of the node to check
Topnode to check children
Out index to keep track of level in the xml
Delete the element or attribut matching the XPath
The path
If true and the node is an attribute, the parent element is deleted. Default false
Get xmlNodeBool from parent node
Insert the new node before any of the nodes in the comma separeted list
Parent node
comma separated list containing nodes to insert after. Left to right order
The new node to be inserterd
Indicates that the value is a decimal number.
Indicates that the value is an Integer
Indicates that the value is a Boolean.
Indicates that the value is an Error.
Indicates that the value is a String.
Indicates that the value is a Rich Value.
Indicates that the value is a Rich Array.
Indicates that the value is a Supporting Property Bag.
A buffer that rolls out memory as it's written to the buffer.