Workbook Methods |
The Workbook type exposes the following members.
Name | Description | |
---|---|---|
![]() |
AcceptAllTrackedChanges |
Accept all tracked changes in the workbook.
|
![]() |
AddCustomFont |
Adds a custom font to the PDF document.
|
![]() |
AddDigitalSignature |
Add a DigitalSignature.
|
![]() |
AddPivotTableStyle |
Adds a pivot table style to the workbook.
|
![]() |
CaculateFormulaValue |
Obsolete.
Computes the string formula
|
![]() |
CalculateAllValue |
Caculate all formula for the workbook
|
![]() |
CalculateFormulaValue |
Computes the string formula
|
![]() ![]() |
ChangePaletteColor |
Changes the palette for the spreadsheet in the specified index.
![]()
The following code snippet illustrates how to set palette color:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set palette color</para><para>workbook.ChangePaletteColor(System.Drawing.Color.Red , 10);</para><para>//Set color</para><para>worksheet["B2"].Style.Color = workbook.Colors[10];</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
|
![]() |
ClearFontCache |
Clear used fonts in cache.
|
![]() |
ColumnWidthToPixels |
onverts column width in characters into column width in pixels.
|
![]() |
ContainsFont |
Indicates whether the workbook contains specified font.
|
![]() |
CopyTheme |
Copy the theme from source workbook
|
![]() |
CopyThemeColor |
Copy the theme color from source workbook
|
![]() |
CopyToClipboard |
Obsolete.
Copies whole workbook to the clipboard.
|
![]() |
CopyToClipboard(Worksheet) |
Obsolete.
Copies the selected worksheet to clipboard.
|
![]() |
CreateEmptySheet |
Create a new worksheet.
|
![]() |
CreateEmptySheet(String) |
Create a new worksheet.
|
![]() |
CreateEmptySheets(Int32) |
Create workbook with specified number of worksheets.
|
![]() |
CreateEmptySheets( String ) |
Create workbook with specified names of worksheets.
|
![]() ![]() |
CreateFont |
Creates a font object and add it to the workbook.
![]()
The following code illustrates how to create IFont object:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>IRichTextString richText = worksheet["B2"].RichText;</para><para>//Create font</para><para>IFont font = workbook.CreateFont();</para><para>//Set color</para><para>font.Color = Color.Red;</para><para>//Set text</para><para>richText.Text = "Sample";</para><para>//Set font</para><para>richText.SetFont(0, 5, font);</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
|
![]() |
CreateFont(Font) |
Creates a font object and add it to the workbook.
|
![]() |
CreatePivotStyle |
Creates a new pivot style in the spreadsheet.
|
![]() |
Dispose |
Disposes of the Excel workbook and suppresses finalization.
|
![]() |
Equals |
Determines whether the specified object is equal to the current object.
(Inherited from
Object
.)
|
![]() ![]() |
FindAllBool |
Finds the cell with the input bool.
![]()
This sample shows how to find all cells with specified bool value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cells with specified bool value</para><para>CellRange[] result = workbook.FindAllBool(true);</para>
|
![]() ![]() |
FindAllDateTime |
Finds the cell with the input datetime.
![]()
This sample shows how to find all cells with specified DateTime value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cells with specified DateTime value</para><para>CellRange[] result = workbook.FindAllDateTime(DateTime.Now);</para>
|
![]() ![]() |
FindAllNumber |
Finds the cell with the input double.
![]()
This sample shows how to find all cells with specified doulbe value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cells with specified double value</para><para>CellRange[] result = workbook.FindAllNumber(100.32 , false);</para>
|
![]() ![]() |
FindAllString |
Finds the cell with the input string.
![]()
This sample shows how to find all cells with specified string value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cells with specified string value</para><para>string value = "value";</para><para>CellRange[] result = workbook.FindAllString(value , false , false);</para>
|
![]() ![]() |
FindAllTimeSpan |
Finds the cell with the input time span.
![]()
This sample shows how to find all cells with specified TimeSpan value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cells with specified TimeSpan value</para><para>TimeSpan value = new TimeSpan(2, 30, 30);</para><para>CellRange[] result = workbook.FindAllTimeSpan(value);</para>
|
![]() ![]() |
FindBool |
Finds the cell with the input bool.
![]()
This sample shows how to find the first cell with specified bool value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cell with specified bool value</para><para>IXLSRange result = workbook.FindBool(true);</para>
|
![]() ![]() |
FindDateTime |
Finds the cell with the input datetime.
![]()
This sample shows how to find the first cell with specified DataTime value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cell with specified DataTime value</para><para>DateTime dateTime = DateTime.Now;</para><para>IXLSRange result = workbook.FindDateTime(dateTime);</para>
|
![]() ![]() |
FindNumber |
Finds the cell with the input number.
![]()
This sample shows how to find the first cell with specified double value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cell with specified double value</para><para>double value = 9.00;</para><para>IXLSRange result = workbook.FindNumber(value, false);</para>
|
![]() ![]() |
FindString |
Finds the cell with the input string.
![]()
This sample shows how to find the first cell with specified string value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cell with specified string value</para><para>string value = "value";</para><para>IXLSRange result = workbook.FindString(value, false, false);</para>
|
![]() ![]() |
FindTimeSpan |
Finds the cell with the input time span.
![]()
This sample shows how to find the first cell with specified TimeSpan value:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Find cell with specified TimeSpan value</para><para>TimeSpan timeSpan = new TimeSpan(2, 30, 30);</para><para>IXLSRange result = workbook.FindTimeSpan(timeSpan);</para>
|
![]() |
GetChartSheetByName |
Retrieves a ChartSheet by its name.
|
![]() |
GetCustomFontParsedResult |
Get result that parse the custom path of font files
|
![]() |
GetDigitalSignatures |
Get collection of DigitalSignature in this file.
|
![]() |
GetHashCode |
Serves as the default hash function.
(Inherited from
Object
.)
|
![]() ![]() |
GetMatchingColor(Color) |
Find best matching Color in workbook palette.
![]()
The following code illustrates how to get the indexed color from ExcelColors for the given color from Color structure:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get color</para><para>ExcelColors color = workbook.GetMatchingColor(System.Drawing.Color.Red);</para><para>//Set color</para><para>worksheet["B2"].Style.KnownColor = color;</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
|
![]() ![]() |
GetMatchingColor(Int32, Int32, Int32) |
Find best matching Color in workbook palette.
![]()
The following code illustrates how to get the indexed color from ExcelColors for the given color from Color structure:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get color</para><para>ExcelColors color = workbook.GetMatchingColor(255, 0, 0);</para><para>//Set color</para><para>worksheet["B2"].Style.KnownColor = color;</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
|
![]() |
GetOleSize |
get the size of the visible range of cells when this workbook is displyed as an embedded obect in another document;
|
![]() ![]() |
GetPaletteColor |
Gets excel color from workbook palette.
![]()
The following code illustrates how to get the RGB color value for the specified color from ExcelColors enumeration:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get color</para><para>System.Drawing.Color color = workbook.GetPaletteColor(ExcelColors.Red);</para><para>//Set color</para><para>worksheet["B2"].Style.Color = workbook.Colors[10];</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
|
![]() |
GetSafeSheetName(String) |
Returns a safe sheet name by replacing invalid characters with a specified replacement character.
|
![]() |
GetSafeSheetName(String, Char) |
Safely converts the input worksheet name by replacing restricted characters and truncating if necessary.
|
![]() |
GetSplitPageInfo |
Retrieves the split page information for the Excel workbook based on the converter settings.
|
![]() |
GetSplitPageTable |
Retrieves a DataTable containing information about the split pages in a workbook.
|
![]() |
GetThemeColor |
Gets theme color.
|
![]() |
GetType |
Gets the
Type
of the current instance.
(Inherited from
Object
.)
|
![]() |
InitCalcEngine |
Initilize Calc engine
|
![]() ![]() |
IsPasswordProtected(Stream) |
Determines if a workbook is password-protected.
|
![]() ![]() |
IsPasswordProtected(String) |
check file is password protect
|
![]() |
LoadFromFile(String) |
Loads a file and imports its data.
|
![]() |
LoadFromFile(String, ExcelVersion) |
Loads a file and imports its data.
|
![]() |
LoadFromFile(String, Boolean) |
Loads a file and imports its data.
|
![]() |
LoadFromFile(String, String) |
Loads text files stream with user defined separator.
|
![]() |
LoadFromFile(String, String, Int32, Int32) |
Loads text files with user defined separator.
|
![]() |
LoadFromFile(String, String, Int32, Int32, ExcelVersion) |
Loads text files with user defined separator.
|
![]() |
LoadFromFile(String, String, Int32, Int32, ExcelVersion, Encoding) |
Loads text files with user defined separator.
|
![]() |
LoadFromHtml(Stream) |
Loads a html file and imports its data.
|
![]() |
LoadFromHtml(String) |
Loads a html file and imports its data.
|
![]() |
LoadFromMHtml(Stream) |
Loads a Mhtml file and imports its data.
|
![]() |
LoadFromMHtml(String) |
Loads a Mhtml file and imports its data.
|
![]() |
LoadFromStream(Stream) |
Load workbook from the stream.
|
![]() |
LoadFromStream(Stream, ExcelVersion) |
Load workbook from the stream.
|
![]() |
LoadFromStream(Stream, Boolean) |
Load workbook from the stream.
|
![]() |
LoadFromStream(Stream, String, Int32, Int32) |
Loads text files stream with user defined separator.max row 60000.
|
![]() |
LoadFromStream(Stream, String, Int32, Int32, ExcelVersion) |
Loads text files stream with user defined separator. Version2007 support 60000+ row
|
![]() |
LoadFromXml(Stream) |
Loads a xml file and imports its data.
|
![]() |
LoadFromXml(String) |
Loads a xml file and imports its data.
|
![]() |
LoadTemplateFromFile(String) |
Load workbook from the excel template.
|
![]() |
LoadTemplateFromFile(String, Boolean) |
Load workbook from the excel template.
|
![]() |
PasteFromClipboard |
Copies workbook and all its worksheets from the clipboard.
|
![]() |
PixelsToColumnWidth |
Converts column width in pixels into column width in characters.
|
![]() |
Protect(String) |
protect file also protect workbook window and structure.
|
![]() |
Protect(String, Boolean, Boolean) |
protect file,also Indicates whether protect workbook window and structure or not
|
![]() |
ProtectWorkbook |
Sets protection for workbook.
|
![]() |
RejectAllTrackedChanges |
Reject all tracked changes in the workbook.
|
![]() |
RemoveAllDigitalSignatures |
Remove all DigitalSignature in this file.
|
![]() ![]() |
Replace(String, DateTime) |
Replaces cell's value by specified value.
![]()
The following code illustrates how to replace the string value with datetime:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by dateTime</para><para>string oldValue = "Find";</para><para>DateTime dateTime = DateTime.Now;</para><para>workbook.Replace(oldValue, dateTime);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
|
![]() ![]() |
Replace(String, Double) |
Replaces cell's value by specified value.
![]()
The following code snippet illustrates how to replace the string with double:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by double</para><para>string oldValue = "Ten";</para><para>workbook.Replace(oldValue, 10.0);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
|
![]() ![]() |
Replace(String, String) |
Replaces cell's value by specified value.
![]()
The following code snippet illustrates how to replace the string with another string:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by newValue</para><para>string oldValue = "Find";</para><para>string newValue = "NewValue";</para><para>workbook.Replace(oldValue, newValue);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
|
![]() ![]() |
Replace(String, DataColumn, Boolean) |
Replaces cell's value from data column values.
![]()
The following code snippet illustrates how to replace the string value with data column:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by data column</para><para>string oldValue = "Find";</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("Dosage", typeof(int));</para><para>table.Rows.Add(1);</para><para>System.Data.DataColumn dataColumn = table.Columns[0];</para><para>workbook.Replace(oldValue, dataColumn, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
|
![]() ![]() |
Replace(String, DataTable, Boolean) |
Replaces cell's value from data table values.
![]()
The following code snippet illustrates how to replace the string value with data table:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by data table</para><para>string oldValue = "Find";</para><para>System.Data.DataTable table = new System.Data.DataTable();</para><para>table.Columns.Add("Dosage", typeof(int));</para><para>table.Rows.Add(1);</para><para>workbook.Replace(oldValue, table, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
|
![]() ![]() |
Replace(String, Double , Boolean) |
Replaces cell's value from array.
![]()
The following code snippet illustrates how to replace the string with array of double values:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by array of double values</para><para>string oldValue = "Find";</para><para>double[] newValues = { 1.0, 2.0 };</para><para>workbook.Replace(oldValue, newValues, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
|
![]() ![]() |
Replace(String, Int32 , Boolean) |
Replaces cell's value from array.
![]()
The following code snippet illustrates how to replace the string with array of int values:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by array of int values</para><para>string oldValue = "Find";</para><para>int[] newValues = { 1, 2 };</para><para>workbook.Replace(oldValue, newValues, true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
|
![]() ![]() |
Replace(String, String , Boolean) |
Replaces cell's value from array.
![]()
The following code snippet illustrates how to replace the string with array of string values:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Replace the oldValue by array of string values</para><para>string oldValue = "Find";</para><para>string[] newValues = { "X values", "Y values" };</para><para>workbook.Replace(oldValue, newValues , true);</para><para>//Save to file</para><para>workbook.SaveToFile("Replace.xlsx");</para>
|
![]() ![]() |
ResetPalette |
Resets the color palette to the default colors.
![]()
The following code snippets illustrates how to reset the palette:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get colors</para><para>System.Drawing.Color[] colors = workbook.Colors;</para><para>//Check color</para><para>Console.WriteLine(colors[2].Name);</para><para>//Set color</para><para>colors[2] = System.Drawing.Color.Yellow;</para><para>//Reset palette</para><para>workbook.ResetPalette();</para><para>//Check color</para><para>Console.WriteLine(workbook.Colors[2].Name);</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
|
![]() |
Save |
Saves changes to the specified workbook
|
![]() |
SaveAsImage(Single, Single) |
Saves the Excel workbook as images.
|
![]() |
SaveAsImage(Int32, Single, Single) |
Save workbook to image.
|
![]() |
SaveAsTemplate(String) |
Save workbook as template to file.
|
![]() |
SaveAsTemplate(String, HttpResponse) |
Save workbook as template to response.
|
![]() |
SaveAsXml(Stream) |
Save workbook as XML format to stream.
|
![]() |
SaveAsXml(String) |
Save workbook to an XML data file.
|
![]() |
SaveChartAsEmfImage(Worksheet) |
Obsolete.
Save chart to vector images.
|
![]() |
SaveChartAsEmfImage(Worksheet, Int32) |
Obsolete.
Save chart to vector image.
|
![]() |
SaveChartAsEmfImage(Worksheet, Int32, Stream) |
Save chart to vector image.
|
![]() |
SaveChartAsImage(ChartSheet) |
Save chart to image.
|
![]() |
SaveChartAsImage(Worksheet) |
Save chart to images.
|
![]() |
SaveChartAsImage(Worksheet, Int32) |
Save chart to image.
|
![]() |
SaveToFile(String) |
Saves changes to the workbook in a different file
|
![]() |
SaveToFile(String, ExcelVersion) |
Saves changes to the workbook in a different file
|
![]() |
SaveToFile(String, FileFormat) |
Saves changes to the workbook in a different file
|
![]() |
SaveToFile(String, TextSaveOptions) |
Saves changes to the workbook in a different file
|
![]() ![]() |
SaveToFile(String, String) |
Saves changes to the workbook in a different file.
![]()
The following code illustrates how to save the active worksheet in a different file with separator:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Save to file</para><para>workbook.SaveToFile("Result.csv" , ",");</para>
|
![]() |
SaveToFile(String, FileFormat, Boolean) |
Saves changes to the workbook in a different file
|
![]() ![]() |
SaveToFile(String, String, Boolean) |
Saves changes to the workbook in a different file.
![]()
The following code illustrates how to save the active worksheet in a different file with separator:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Save to file</para><para>workbook.SaveToFile("Result.csv" , ",", true);</para>
|
![]() |
SaveToHtml(String) |
Saves the workbook to html
|
![]() |
SaveToHtml(String, Boolean) |
Saves the workbook to html
|
![]() |
SaveToHttpResponse(String, HttpResponse) |
Save workbook to the http response.
|
![]() |
SaveToHttpResponse(String, HttpResponse, HttpContentType) |
Save workbook to the http response.
|
![]() |
SaveToHttpResponse(String, HttpResponse, Boolean) |
Save workbook to the http response.
|
![]() |
SaveToHttpResponse(String, HttpResponse, HttpContentType, FileFormat) |
Save workbook to the http response.
|
![]() |
SaveToMarkdown |
Saves the workbook to markdown
|
![]() |
SaveToStream(Stream) |
Save workbook the stream
|
![]() |
SaveToStream(Stream, FileFormat) |
Save workbook to stream.
|
![]() ![]() |
SaveToStream(Stream, String) |
Save workbook the stream.
![]()
The following code illustrates how to saves the active worksheet as stream with separator:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Save to stream</para><para>Stream stream = new MemoryStream();</para><para>workbook.SaveToFile(stream , ",");</para>
|
![]() ![]() |
SetGlobalCustomFontsFolders |
Sets the path to the folder where the global custom font is located.
|
![]() |
SetMaxDigitWidth |
Sets the maximum digit width for the Excel workbook.
|
![]() |
SetOleSize |
set the size of the visible range of cells when this workbook is displyed as an embedded obect in another document;
|
![]() |
SetThemeColor |
Sets the theme color
|
![]() |
SetWriteProtectionPassword |
Sets write protection password.
|
![]() |
SprBpcmUuRG9jLkRvY3Vt |
Set internal license information(office viewer).
|
![]() |
ToString |
Returns a string that represents the current object.
(Inherited from
Object
.)
|
![]() |
UnProtect |
unprotect file
also upprotect workbook window and structure
|
![]() |
UnProtect(String) |
unprotect file
also upprotect workbook window and structure
|
![]() |
UnProtectWorkbook |
unprotect workbook window and structure
|
![]() |
XlsPageToImagedg |
XLS Load Page Data Delegate Method
|