} // MssCell_WriteColumnRange /// <summary> /// Write a dataset to a range of column cells /// Accepts format for the target cells /// </summary> /// <param name="ssWorksheet">Worksheet to write to</param> /// <param name="ssRow">rownumber</param> /// <param name="ssColumnStart">Start column (integer)</param> /// <param name="ssValueList">Values to write to columns</param> /// <param name="ssCellType">Type can by text (default), datetime, integer, decimal, boolean</param> /// <param name="ssCellFormat">CellFormat for the target cells</param> public void MssCell_WriteColumnRangeWithFormat(object ssWorksheet, int ssRow, int ssColumnStart, RLValueRecordList ssValueList, string ssCellType, RCCellFormatRecord ssCellFormat) { // TODO: Write implementation for action } // MssCell_WriteColumnRangeWithFormat
} // MssCell_WriteImageByName /// <summary> /// Write a dataset to a range of cells. /// Accepts format for the target cells /// </summary> /// <param name="ssWorksheet">Worksheet to write to</param> /// <param name="ssRowStart">Start row (integer)</param> /// <param name="ssColumnStart">Start column (integer)</param> /// <param name="ssDataSet">Data to write</param> /// <param name="ssCellFormat">CellFormat for the target cells</param> public void MssCell_WriteRangeWithFormat(object ssWorksheet, int ssRowStart, int ssColumnStart, object ssDataSet, RCCellFormatRecord ssCellFormat) { // TODO: Write implementation for action } // MssCell_WriteRangeWithFormat
} // MssCell_WriteByIndex /// <summary> /// Write a converted value to a cell, defined by its index. /// Accepts format for the target cell /// </summary> /// <param name="ssWorksheet">Worksheet on which the cell resides</param> /// <param name="ssRow">Row Number</param> /// <param name="ssColumn">Column Number</param> /// <param name="ssCellValue">Text Value</param> /// <param name="ssCellType">Type can by text (default), datetime, integer, decimal, boolean</param> /// <param name="ssCellFormat">CellFormat for the target cell</param> public void MssCell_WriteByIndexWithFormat(object ssWorksheet, int ssRow, int ssColumn, string ssCellValue, string ssCellType, RCCellFormatRecord ssCellFormat) { // TODO: Write implementation for action } // MssCell_WriteByIndexWithFormat
} // MssCell_WriteByName /// <summary> /// Write a converted value to a cell, defined by its name. /// Accepts format for the target cell /// </summary> /// <param name="ssWorksheet">Worksheet in which the cell resides</param> /// <param name="ssCellName">Cell-name (eg A4)</param> /// <param name="ssCellValue">Value to write</param> /// <param name="ssCellType">Type can by text (default), datetime, integer, decimal, boolean</param> /// <param name="ssCellFormat">CellFormat for the target cell</param> public void MssCell_WriteByNameWithFormat(object ssWorksheet, string ssCellName, string ssCellValue, string ssCellType, RCCellFormatRecord ssCellFormat) { // TODO: Write implementation for action } // MssCell_WriteByNameWithFormat
} // MssCell_CalculateByName /// <summary> /// Apply format to a range of cells. /// </summary> /// <param name="ssWorksheet">Worksheet to write to</param> /// <param name="ssRowStart">Start row (integer)</param> /// <param name="ssColumnStart">Start column (integer)</param> /// <param name="ssRowEnd">End row (integer)</param> /// <param name="ssColumnEnd">End column (integer)</param> /// <param name="ssCellFormat">CellFormat for the target cells</param> public void MssCell_FormatRange(object ssWorksheet, int ssRowStart, int ssColumnStart, int ssRowEnd, int ssColumnEnd, RCCellFormatRecord ssCellFormat) { // TODO: Write implementation for action } // MssCell_FormatRange
} // MssWorkbook_ChangeSheetIndex /// <summary> /// Apply a specified cell format to the range specified for the given worksheet /// </summary> /// <param name="ssWorksheet">Worksheet object where formatting is to be applied</param> /// <param name="ssCellFormat">CellFormat to apply</param> /// <param name="ssRange">Range that CellFormat is to be applied to</param> public void MssCellFormat_ApplyToRange(object ssWorksheet, RCCellFormatRecord ssCellFormat, RCRangeRecord ssRange) { // TODO: Write implementation for action } // MssCellFormat_ApplyToRange
} // MssCell_Write /// <summary> /// Write a dataset to a range of cells. /// Accepts format for the target cells /// </summary> /// <param name="ssWorksheet">Worksheet to write to</param> /// <param name="ssRowStart">Start row (integer)</param> /// <param name="ssColumnStart">Start column (integer)</param> /// <param name="ssDataSet">Data to write</param> /// <param name="ssCellFormat">CellFormat for the target cells</param> /// <param name="ssExportHeaders">True to include headers in export file. Default value = False</param> public void MssCell_WriteRange(object ssWorksheet, int ssRowStart, int ssColumnStart, object ssDataSet, RCCellFormatRecord ssCellFormat, bool ssExportHeaders) { // TODO: Write implementation for action } // MssCell_WriteRange
} // MssWorksheet_Protect /// <summary> /// Write a converted value to a cell. /// </summary> /// <param name="ssWorksheet">Worksheet on which the cell resides </param> /// <param name="ssCellName">Name of the cell to write to, i.e. A4. Required if CellRow and CellColumn not set</param> /// <param name="ssCellRow">Row number of the cell to write to. Required if CellName not set.</param> /// <param name="ssCellColumn">Column number of the cell to write to. Required if CellName not set.</param> /// <param name="ssCellValue">The value to write to the cell</param> /// <param name="ssCellType">Type can be: /// text (default), /// datetime, /// integer, /// decimal, /// boolean, /// formula</param> /// <param name="ssCellFormat">CellFormat for the target cell</param> public void MssCell_Write(object ssWorksheet, string ssCellName, int ssCellRow, int ssCellColumn, string ssCellValue, string ssCellType, RCCellFormatRecord ssCellFormat) { // TODO: Write implementation for action } // MssCell_Write
/// <summary> /// Apply the specified format to a range of cells /// </summary> /// <param name="range">The range of cells to apply the formatting to</param> /// <param name="format">The format to apply to the range of cells</param> internal static void ApplyFormatToRange(ExcelRange range, RCCellFormatRecord format) { if (format == null) { LogMessage("Format object is null"); return; } if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssFontName)) { range.Style.Font.Name = format.ssSTCellFormat.ssFontName; } if (format.ssSTCellFormat.ssFontSize != 0) { range.Style.Font.Size = format.ssSTCellFormat.ssFontSize; } if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssBackgroundColor)) { Color color = Util.ConvertFromColorCode(format.ssSTCellFormat.ssBackgroundColor); range.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; range.Style.Fill.BackgroundColor.SetColor(color); } if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssFontColor)) { Color color = Util.ConvertFromColorCode(format.ssSTCellFormat.ssFontColor); range.Style.Font.Color.SetColor(color); } if (format.ssSTCellFormat.ssBold) { range.Style.Font.Bold = true; } // Entire Border - DEPRECATED if (format.ssSTCellFormat.ssBorderStyle > 0) { Color borderColor = new Color(); if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssBorderColor)) { borderColor = Util.ConvertFromColorCode(format.ssSTCellFormat.ssBorderColor); } ExcelBorderStyle borderStyle = (ExcelBorderStyle)format.ssSTCellFormat.ssBorderStyle; range.Style.Border.BorderAround(borderStyle, borderColor); } // Border Top if (format.ssSTCellFormat.ssBorderTop.ssSTBorderStyle.ssStyle > 0) { Color borderColor = new Color(); if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssBorderTop.ssSTBorderStyle.ssColor)) { borderColor = Util.ConvertFromColorCode(format.ssSTCellFormat.ssBorderTop.ssSTBorderStyle.ssColor); } ExcelBorderStyle borderStyle = (ExcelBorderStyle)format.ssSTCellFormat.ssBorderTop.ssSTBorderStyle.ssStyle; range.Style.Border.BorderAround(borderStyle, borderColor); } // Border Left if (format.ssSTCellFormat.ssBorderLeft.ssSTBorderStyle.ssStyle > 0) { Color borderColor = new Color(); if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssBorderLeft.ssSTBorderStyle.ssColor)) { borderColor = Util.ConvertFromColorCode(format.ssSTCellFormat.ssBorderLeft.ssSTBorderStyle.ssColor); } ExcelBorderStyle borderStyle = (ExcelBorderStyle)format.ssSTCellFormat.ssBorderLeft.ssSTBorderStyle.ssStyle; range.Style.Border.BorderAround(borderStyle, borderColor); } // Border Right if (format.ssSTCellFormat.ssBorderRight.ssSTBorderStyle.ssStyle > 0) { Color borderColor = new Color(); if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssBorderRight.ssSTBorderStyle.ssColor)) { borderColor = Util.ConvertFromColorCode(format.ssSTCellFormat.ssBorderRight.ssSTBorderStyle.ssColor); } ExcelBorderStyle borderStyle = (ExcelBorderStyle)format.ssSTCellFormat.ssBorderRight.ssSTBorderStyle.ssStyle; range.Style.Border.BorderAround(borderStyle, borderColor); } // Border Bottom if (format.ssSTCellFormat.ssBorderBottom.ssSTBorderStyle.ssStyle > 0) { Color borderColor = new Color(); if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssBorderBottom.ssSTBorderStyle.ssColor)) { borderColor = Util.ConvertFromColorCode(format.ssSTCellFormat.ssBorderBottom.ssSTBorderStyle.ssColor); } ExcelBorderStyle borderStyle = (ExcelBorderStyle)format.ssSTCellFormat.ssBorderBottom.ssSTBorderStyle.ssStyle; range.Style.Border.BorderAround(borderStyle, borderColor); } if (format.ssSTCellFormat.ssAutofitColumn) { range.AutoFitColumns(); } if (!string.IsNullOrEmpty(format.ssSTCellFormat.ssNumberFormat)) { range.Style.Numberformat.Format = format.ssSTCellFormat.ssNumberFormat; } if (format.ssSTCellFormat.ssHorizontalAlignment > 0) { range.Style.HorizontalAlignment = (ExcelHorizontalAlignment)format.ssSTCellFormat.ssHorizontalAlignment; } if (format.ssSTCellFormat.ssVerticalAlignment > 0) { range.Style.VerticalAlignment = (ExcelVerticalAlignment)format.ssSTCellFormat.ssVerticalAlignment; } if (format.ssSTCellFormat.ssWrapText) { range.Style.WrapText = format.ssSTCellFormat.ssWrapText; } if (format.ssSTCellFormat.ssTextRotation > 0) { range.Style.TextRotation = format.ssSTCellFormat.ssTextRotation; } if (format.ssSTCellFormat.ssShrinkToFit) { range.Style.ShrinkToFit = format.ssSTCellFormat.ssShrinkToFit; } if (format.ssSTCellFormat.ssReadingOrder > 0) { range.Style.ReadingOrder = (ExcelReadingOrder)format.ssSTCellFormat.ssReadingOrder; } if (format.ssSTCellFormat.ssQuotePrefix) { range.Style.QuotePrefix = format.ssSTCellFormat.ssQuotePrefix; } if (format.ssSTCellFormat.ssLocked) { range.Style.Locked = format.ssSTCellFormat.ssLocked; } if (format.ssSTCellFormat.ssIndent > 0) { range.Style.Indent = format.ssSTCellFormat.ssIndent; } if (format.ssSTCellFormat.ssHidden) { range.Style.Hidden = format.ssSTCellFormat.ssHidden; } }