Interface IWorkbook
public interface IWorkbook : IExcelApplication
- Inherited Members
Properties
ActiveSheet
Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active. Read-only.
IWorksheet ActiveSheet { get; }
Property Value
ActiveSheetIndex
Gets / sets index of the active sheet.
int ActiveSheetIndex { get; set; }
Property Value
AddInFunctions
Returns collection of all workbook's add-in functions. Read-only.
IAddInFunctions AddInFunctions { get; }
Property Value
Allow3DRangesInDataValidation
Indicates whether to allow usage of 3D ranges in DataValidation list property (MS Excel doesn't allow).
bool Allow3DRangesInDataValidation { get; set; }
Property Value
ArgumentsSeparator
Formula arguments separator.
string ArgumentsSeparator { get; }
Property Value
Author
Returns or sets the author of the comment. Read-only String.
string Author { get; set; }
Property Value
BuiltInDocumentProperties
Returns collection that represents all the built-in document properties
for the specified workbook. Read-only.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Get the built in document properties
IBuiltInDocumentProperties builtInDocumentProperties = workbook.DocumentProperties;
IBuiltInDocumentProperties BuiltInDocumentProperties { get; }
Property Value
Charts
Collection of the chart objects.
ICharts Charts { get; }
Property Value
CodeName
Name which is used by macros to access the workbook items.
string CodeName { get; set; }
Property Value
CustomDocumentProperties
Returns collection that represents all the custom document properties
for the specified workbook. Read-only.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Get the document properties
ICustomDocumentProperties documentProperties = workbook.CustomDocumentProperties;
ICustomDocumentProperties CustomDocumentProperties { get; }
Property Value
Date1904
True if the workbook uses the 1904 date system. Read / write Boolean.
bool Date1904 { get; set; }
Property Value
DetectDateTimeInValue
Indicates whether library should try to detect string value passed to Value (and Value2) property as DateTime. Setting this property to false can increase performance greatly for such operations especially on Framework 1.0 and 1.1. Default value is true.
bool DetectDateTimeInValue { get; set; }
Property Value
DisableMacrosStart
This Property allows users to disable load of macros from document. Excel on file open will simply skip macros and will work as if document does not contain them. This options works only when file contains macros (HasMacros property is True).
bool DisableMacrosStart { get; set; }
Property Value
DisplayWorkbookTabs
Indicates whether tabs are visible.
bool DisplayWorkbookTabs { get; set; }
Property Value
DisplayedTab
Index of tab which will be displayed on document open.
int DisplayedTab { get; set; }
Property Value
HasMacros
True indicate that opened workbook contains VBA macros.
bool HasMacros { get; }
Property Value
IsCellProtection
True if cell is protected.
bool IsCellProtection { get; }
Property Value
IsDisplayPrecision
True if cell is protected.
bool IsDisplayPrecision { get; set; }
Property Value
IsHScrollBarVisible
Gets or sets a value indicating whether to display horizontal scroll bar.
//Create workbook
Workbook workbook = new Workbook();
//Hide horizontal scroll bar
workbook.IsHScrollBarVisible = false;
//Save to file
workbook.SaveToFile("IsHScrollBarVisible.xlsx");
bool IsHScrollBarVisible { get; set; }
Property Value
IsRightToLeft
Indicates whether worksheet is displayed right to left.
bool IsRightToLeft { get; set; }
Property Value
IsVScrollBarVisible
Gets or sets a value indicating whether to display vertical scroll bar.
//Create workbook
Workbook workbook = new Workbook();
//Hide vertical scroll bar
workbook.IsVScrollBarVisible = false;
//Save to file
workbook.SaveToFile("IsVScrollBarVisible.xlsx");
bool IsVScrollBarVisible { get; set; }
Property Value
IsWindowProtection
True if window is protected.
bool IsWindowProtection { get; }
Property Value
MaxColumnCount
Returns maximum column count for each worksheet in this workbook. Read-only.
int MaxColumnCount { get; }
Property Value
MaxRowCount
Returns maximum row count for each worksheet in this workbook. Read-only.
int MaxRowCount { get; }
Property Value
Names
For an ReservedHandle object, returns a Names collection that represents
all the names in the active workbook. For a Workbook object, returns
a Names collection that represents all the names in the specified
workbook (including all worksheet-specific names).
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Get names
INameRanges names = workbook.NameRanges;
INameRanges Names { get; }
Property Value
Palette
Get Palette of colors which an Excel document can have. Here is a table of color indexes to places in the color tool box provided by Excel application:
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ---+---------------------------------------- |1 | 00 | 51 | 50 | 49 | 47 | 10 | 53 | 54 | |2 | 08 | 45 | 11 | 09 | 13 | 04 | 46 | 15 | |3 | 02 | 44 | 42 | 48 | 41 | 40 | 12 | 55 | |4 | 06 | 43 | 05 | 03 | 07 | 32 | 52 | 14 | |5 | 37 | 39 | 35 | 34 | 33 | 36 | 38 | 01 | ---+---------------------------------------- |6 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | |7 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Get colors
System.Drawing.Color[] colors = workbook.Colors;
//Get color
System.Drawing.Color color = colors[2];
//Set color
worksheet["B2"].Style.Color = color;
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
Color[] Palette { get; }
Property Value
- Color[]
PasswordToOpen
Gets / sets password to encrypt document.
string PasswordToOpen { get; set; }
Property Value
PivotCaches
Returns pivot caches collection. Read-only.
//Load workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Gets pivot caches collection
IPivotCaches pivotCaches = workbook.PivotCaches;
XlsPivotCachesCollection PivotCaches { get; }
Property Value
ReadOnly
True if the workbook has been opened as Read-only. Read-only Boolean.
bool ReadOnly { get; }
Property Value
ReadOnlyRecommended
True to display a message when the file is opened, recommending that the file be opened as read-only.
bool ReadOnlyRecommended { get; set; }
Property Value
RowSeparator
Gets / sets row separator for array parsing.
string RowSeparator { get; }
Property Value
Saved
True if no changes have been made to the specified workbook since it was last saved. Read/write Boolean.
bool Saved { get; set; }
Property Value
StandardFont
Returns or sets the name of the standard font. Read/write String.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
worksheet["B2"].Text = "Text";
//Set standard font
workbook.DefaultFontName = "Arial";
//Set standard font size
workbook.DefaultFontSize = 18;
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
string StandardFont { get; set; }
Property Value
StandardFontSize
Returns or sets the standard font size, in points. Read/write.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
worksheet["B2"].Text = "Text";
//Set standard font
workbook.DefaultFontName = "Arial";
//Set standard font size
workbook.DefaultFontSize = 18;
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
double StandardFontSize { get; set; }
Property Value
Styles
Returns a Styles collection that represents all the styles
in the specified workbook. Read-only.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set styles
IStyles styles = workbook.Styles;
IStyles Styles { get; }
Property Value
TabSheets
Returns collection of tab sheets. Read-only.
ITabSheets TabSheets { get; }
Property Value
ThrowOnUnknownNames
Indicates whether exception should be thrown when unknown name was found in a formula.
bool ThrowOnUnknownNames { get; set; }
Property Value
Version
Gets / sets excel version.
ExcelVersion Version { get; set; }
Property Value
Worksheets
Returns a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.
IWorksheets Worksheets { get; }
Property Value
Methods
Activate()
Activates the first window associated with the workbook.
void Activate()
AddFont(IFont)
Adds font to the inner fonts collection and makes this font read-only.
IFont AddFont(IFont fontToAdd)
Parameters
fontToAdd
IFontFont to add.
Returns
- IFont
Added font.
Clone()
Creates copy of the current instance.
IWorkbook Clone()
Returns
- IWorkbook
Copy of the current instance.
Close()
Closes the object without saving.
void Close()
Close(bool)
Closes the object.
void Close(bool saveChanges)
Parameters
saveChanges
boolIf True, all changes will be saved.
Close(bool, string)
Closes the object.
void Close(bool SaveChanges, string Filename)
Parameters
Close(string)
Closes the object and saves changes into specified file.
void Close(string Filename)
Parameters
Filename
stringFile name in which workbook will be saved if SaveChanges is true.
CopyToClipboard()
Copies workbook to the clipboard.
void CopyToClipboard()
CreateFont()
Method to create a font object and register it in the workbook.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set text
IRichTextString richText = worksheet["B2"].RichText;
//Create font
IFont font = workbook.CreateFont();
//Set color
font.Color = Color.Red;
//Set text
richText.Text = "Sample";
//Set font
richText.SetFont(0, 5, font);
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
IFont CreateFont()
Returns
- IFont
Newly created font.
CreateFont(IFont)
Method that creates font object based on another font object and registers it in the workbook.
IFont CreateFont(IFont baseFont)
Parameters
baseFont
IFontBase font for the new one.
Returns
- IFont
Newly created font.
CreateFont(string, float, int)
Method creates a font object based on native font and register it in the workbook.
IFont CreateFont(string familyName, float size, int fontStyle)
Parameters
Returns
- IFont
Newly created font.
CreateTemplateMarkersProcessor()
Creates object that can be used for template markers processing.
IMarkersDesigner CreateTemplateMarkersProcessor()
Returns
- IMarkersDesigner
Object that can be used for template markers processing.
FindAll(bool)
This method seraches for the all cells with specified bool value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cells with specified bool value
CellRange[] result = workbook.FindAllBool(true);
CellRange[] FindAll(bool findValue)
Parameters
findValue
boolValue to search.
Returns
- CellRange[]
All found cells, or Null if value was not found
FindAll(DateTime)
This method seraches for the all cells with specified DateTime value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cells with specified DateTime value
CellRange[] result = workbook.FindAllDateTime(DateTime.Now);
CellRange[] FindAll(DateTime findValue)
Parameters
findValue
DateTimeValue to search.
Returns
- CellRange[]
All found cells, or Null if value was not found.
FindAll(double, FindType)
This method seraches for the all cells with specified double value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cells with specified double value
CellRange[] result = workbook.FindAllNumber(100.32 , false);
CellRange[] FindAll(double findValue, FindType flags)
Parameters
Returns
- CellRange[]
All found cells, or Null if value was not found.
FindAll(string, FindType)
This method seraches for the all cells with specified string value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cells with specified string value
string value = "value";
CellRange[] result = workbook.FindAllString(value , false , false);
CellRange[] FindAll(string findValue, FindType flags)
Parameters
Returns
- CellRange[]
All found cells, or Null if value was not found.
FindAll(TimeSpan)
This method seraches for the all cells with specified TimeSpan value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cells with specified TimeSpan value
TimeSpan value = new TimeSpan(2, 30, 30);
CellRange[] result = workbook.FindAllTimeSpan(value);
CellRange[] FindAll(TimeSpan findValue)
Parameters
findValue
TimeSpanValue to search.
Returns
- CellRange[]
All found cells, or Null if value was not found.
FindOne(bool)
This method seraches for the first cell with specified bool value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cell with specified bool value
IXLSRange result = workbook.FindBool(true);
IXLSRange FindOne(bool findValue)
Parameters
findValue
boolValue to search.
Returns
- IXLSRange
First found cell, or Null if value was not found.
FindOne(DateTime)
This method seraches for the first cell with specified DateTime value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cell with specified DateTime value
DateTime dateTime = DateTime.Now;
IXLSRange result = workbook.FindDateTime(dateTime);
IXLSRange FindOne(DateTime findValue)
Parameters
findValue
DateTimeValue to search.
Returns
- IXLSRange
First found cell, or Null if value was not found.
FindOne(double, FindType)
This method seraches for the first cell with specified double value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cell with specified double value
double value = 9.00;
IXLSRange result = workbook.FindNumber(value, false);
IXLSRange FindOne(double findValue, FindType flags)
Parameters
Returns
- IXLSRange
First found cell, or Null if value was not found.
FindOne(string, FindType)
This method seraches for the first cell with specified string value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cell with specified string value
string value = "value";
IXLSRange result = workbook.FindString(value, false, false);
IXLSRange FindOne(string findValue, FindType flags)
Parameters
Returns
- IXLSRange
First found cell, or Null if value was not found.
FindOne(TimeSpan)
This method seraches for the first cell with specified TimeSpan value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Find cell with specified TimeSpan value
TimeSpan timeSpan = new TimeSpan(2, 30, 30);
IXLSRange result = workbook.FindTimeSpan(timeSpan);
IXLSRange FindOne(TimeSpan findValue)
Parameters
findValue
TimeSpanValue to search.
Returns
- IXLSRange
First found cell, or Null if value was not found.
GetNearestColor(Color)
Gets the nearest color to the specified Color structure
from Workbook palette.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Get color
ExcelColors color = workbook.GetMatchingColor(System.Drawing.Color.Red);
//Set color
worksheet["B2"].Style.KnownColor = color;
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
ExcelColors GetNearestColor(Color color)
Parameters
color
ColorSystem color.
Returns
- ExcelColors
Color index from workbook palette.
GetNearestColor(int, int, int)
Gets the nearest color to the specified by red, green, and blue
values color from Workbook palette.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Get color
ExcelColors color = workbook.GetMatchingColor(255, 0, 0);
//Set color
worksheet["B2"].Style.KnownColor = color;
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
ExcelColors GetNearestColor(int r, int g, int b)
Parameters
r
intRed component of the color.
g
intGreen component of the color.
b
intBlue component of the color.
Returns
- ExcelColors
Color index from workbook palette.
GetPaletteColor(ExcelColors)
Method return Color object from workbook palette by its index.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Get color
System.Drawing.Color color = workbook.GetPaletteColor(ExcelColors.Red);
//Set color
worksheet["B2"].Style.Color = workbook.Colors[10];
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
Color GetPaletteColor(ExcelColors color)
Parameters
color
ExcelColorsIndex from palette array.
Returns
- Color
RGB Color.
Protect(bool, bool)
Sets protection for workbook.
void Protect(bool bIsProtectWindow, bool bIsProtectContent)
Parameters
bIsProtectWindow
boolIndicates if protect workbook window.
bIsProtectContent
boolIndicates if protect workbook content.
Replace(string, DataColumn, bool)
Replaces specified string by data column values.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Replace the oldValue by data column
string oldValue = "Find";
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("Dosage", typeof(int));
table.Rows.Add(1);
System.Data.DataColumn dataColumn = table.Columns[0];
workbook.Replace(oldValue, dataColumn, true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, DataColumn newValues, bool isFieldNamesShown)
Parameters
oldValue
stringString value to replace.
newValues
DataColumnData table with new data.
isFieldNamesShown
boolIndicates whether field name must be shown.
Replace(string, DataTable, bool)
Replaces specified string by data table values.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Replace the oldValue by data table
string oldValue = "Find";
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("Dosage", typeof(int));
table.Rows.Add(1);
workbook.Replace(oldValue, table, true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, DataTable newValues, bool isFieldNamesShown)
Parameters
oldValue
stringString value to replace.
newValues
DataTableData table with new data.
isFieldNamesShown
boolIndicates whether field name must be shown.
Replace(string, DateTime)
Replaces specified string by specified value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Replace the oldValue by dateTime
string oldValue = "Find";
DateTime dateTime = DateTime.Now;
workbook.Replace(oldValue, dateTime);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, DateTime newValue)
Parameters
oldValue
stringString value to replace.
newValue
DateTimeNew value for the range with specified string.
Replace(string, double)
Replaces specified string by specified value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Replace the oldValue by double
string oldValue = "Ten";
workbook.Replace(oldValue, 10.0);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, double newValue)
Parameters
oldValue
stringString value to replace.
newValue
doubleNew value for the range with specified string.
Replace(string, double[], bool)
Replaces specified string by data from array.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Replace the oldValue by array of double values
string oldValue = "Find";
double[] newValues = { 1.0, 2.0 };
workbook.Replace(oldValue, newValues, true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, double[] newValues, bool isVertical)
Parameters
oldValue
stringString value to replace.
newValues
double[]Array of new values.
isVertical
boolIndicates whether array should be inserted vertically.
Replace(string, int[], bool)
Replaces specified string by data from array.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Replace the oldValue by array of int values
string oldValue = "Find";
int[] newValues = { 1, 2 };
workbook.Replace(oldValue, newValues, true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, int[] newValues, bool isVertical)
Parameters
oldValue
stringString value to replace.
newValues
int[]Array of new values.
isVertical
boolIndicates whether array should be inserted vertically.
Replace(string, string)
Replaces specified string by specified value.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Replace the oldValue by newValue
string oldValue = "Find";
string newValue = "NewValue";
workbook.Replace(oldValue, newValue);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, string newValue)
Parameters
oldValue
stringString value to replace.
newValue
stringNew value for the range with specified string.
Replace(string, string[], bool)
Replaces specified string by data from array.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Replace the oldValue by array of string values
string oldValue = "Find";
string[] newValues = { "X values", "Y values" };
workbook.Replace(oldValue, newValues , true);
//Save to file
workbook.SaveToFile("Replace.xlsx");
void Replace(string oldValue, string[] newValues, bool isVertical)
Parameters
oldValue
stringString value to replace.
newValues
string[]Array of new values.
isVertical
boolIndicates whether array should be inserted vertically.
ResetPalette()
Recover palette to default values.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Get colors
System.Drawing.Color[] colors = workbook.Colors;
//Check color
Console.WriteLine(colors[2].Name);
//Set color
colors[2] = System.Drawing.Color.Yellow;
//Reset palette
workbook.ResetPalette();
//Check color
Console.WriteLine(workbook.Colors[2].Name);
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
void ResetPalette()
Save()
Saves changes to the specified workbook.
//Load workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Save to file
workbook.Save();
void Save()
SaveAs(Stream)
Saves changes to the specified stream.
void SaveAs(Stream stream)
Parameters
stream
StreamStream that will receive workbook data.
SaveAs(Stream, ExcelSaveType)
Saves changes to the specified stream.
void SaveAs(Stream stream, ExcelSaveType saveType)
Parameters
stream
StreamStream that will receive workbook data.
saveType
ExcelSaveTypeType of the Excel file.
SaveAs(Stream, string)
Save active WorkSheet using separator.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Save to stream
Stream stream = new MemoryStream();
workbook.SaveToFile(stream , ",");
void SaveAs(Stream stream, string separator)
Parameters
SaveAs(string)
Short variant of SaveAs method.
void SaveAs(string Filename)
Parameters
Filename
string
SaveAs(string, ExcelSaveType)
Short variant of SaveAs method.
void SaveAs(string Filename, ExcelSaveType saveType)
Parameters
Filename
stringName of the file.
saveType
ExcelSaveTypeExcel save type.
SaveAs(string, string)
Save active WorkSheet using separator.
//Create workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
//Save to file
workbook.SaveToFile("Result.csv" , ",");
void SaveAs(string fileName, string separator)
Parameters
SetColorOrGetNearest(Color)
If there is at least one free color, define a new color; if not, search for the closest one.
ExcelColors SetColorOrGetNearest(Color color)
Parameters
color
Color
Returns
- ExcelColors
Color index from workbook palette.
SetColorOrGetNearest(int, int, int)
If there is at least one free color, define a new color; if not, search for the closest one.
ExcelColors SetColorOrGetNearest(int r, int g, int b)
Parameters
r
intRed component of the color.
g
intGreen component of the color.
b
intBlue component of the color.
Returns
- ExcelColors
Color index from workbook palette.
SetPaletteColor(int, Color)
Set user color for specified element in Color table.
//Create worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set palette color
workbook.ChangePaletteColor(System.Drawing.Color.Red , 10);
//Set color
worksheet["B2"].Style.Color = workbook.Colors[10];
//Save to file
workbook.SaveToFile("CellFormats.xlsx");
void SetPaletteColor(int index, Color color)
Parameters
SetSeparators(char, char)
Sets separators for formula parsing.
void SetSeparators(char argumentsSeparator, char arrayRowsSeparator)
Parameters
argumentsSeparator
charArguments separator to set.
arrayRowsSeparator
charArray rows separator to set.
SetWriteProtectionPassword(string)
This method sets write protection password.
void SetWriteProtectionPassword(string password)
Parameters
password
stringPassword to set.
Unprotect()
Unprotects workbook.
void Unprotect()