本文整理汇总了C#中CellRangeAddress类的典型用法代码示例。如果您正苦于以下问题:C# CellRangeAddress类的具体用法?C# CellRangeAddress怎么用?C# CellRangeAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CellRangeAddress类属于命名空间,在下文中一共展示了CellRangeAddress类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetBorderBottom
//[Obsolete]
//public static void SetBorderBottom(NPOI.SS.UserModel.CellBorderType border, Region region, HSSFSheet sheet,
// HSSFWorkbook workbook)
//{
// SetBorderBottom(border, toCRA(region), sheet, workbook);
//}
/// <summary>
/// Sets the borderBottom attribute of the HSSFRegionUtil object
/// </summary>
/// <param name="border">The new border</param>
/// <param name="region">The region that should have the border</param>
/// <param name="sheet">The sheet that the region is on.</param>
/// <param name="workbook">The workbook that the region is on.</param>
public static void SetBorderBottom(NPOI.SS.UserModel.CellBorderType border, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook)
{
int colStart = region.FirstColumn;
int colEnd = region.LastColumn;
int rowIndex = region.LastRow;
CellPropertySetter cps = new CellPropertySetter(workbook, HSSFCellUtil.BORDER_BOTTOM, (int)border);
NPOI.SS.UserModel.Row row = HSSFCellUtil.GetRow(rowIndex, sheet);
for (int i = colStart; i <= colEnd; i++)
{
cps.SetProperty(row, i);
}
}
开发者ID:babywzazy,项目名称:Server,代码行数:26,代码来源:HSSFRegionUtil.cs
示例2: FeatRecord
public FeatRecord(RecordInputStream in1)
{
futureHeader = new FtrHeader(in1);
isf_sharedFeatureType = in1.ReadShort();
reserved1 = (byte)in1.ReadByte();
reserved2 = in1.ReadInt();
int cref = in1.ReadUShort();
cbFeatData = in1.ReadInt();
reserved3 = in1.ReadShort();
cellRefs = new CellRangeAddress[cref];
for (int i = 0; i < cellRefs.Length; i++)
{
cellRefs[i] = new CellRangeAddress(in1);
}
switch (isf_sharedFeatureType)
{
case FeatHdrRecord.SHAREDFEATURES_ISFPROTECTION:
sharedFeature = new FeatProtection(in1);
break;
case FeatHdrRecord.SHAREDFEATURES_ISFFEC2:
sharedFeature = new FeatFormulaErr2(in1);
break;
case FeatHdrRecord.SHAREDFEATURES_ISFFACTOID:
sharedFeature = new FeatSmartTag(in1);
break;
default:
System.Console.WriteLine("Unknown Shared Feature " + isf_sharedFeatureType + " found!");
break;
}
}
开发者ID:missxiaohuang,项目名称:Weekly,代码行数:33,代码来源:FeatRecord.cs
示例3: CFHeaderRecord
public CFHeaderRecord(CellRangeAddress[] regions, int nRules)
{
CellRangeAddress[] unmergedRanges = regions;
CellRangeAddress[] mergeCellRanges = CellRangeUtil.MergeCellRanges(unmergedRanges);
CellRanges= mergeCellRanges;
field_1_numcf = nRules;
}
开发者ID:ctddjyds,项目名称:npoi,代码行数:7,代码来源:CFHeaderRecord.cs
示例4: MergeCellsRecord
/**
* Constructs a MergedCellsRecord and Sets its fields appropriately
* @param in the RecordInputstream to Read the record from
*/
public MergeCellsRecord(RecordInputStream in1)
{
int nRegions = in1.ReadUShort();
CellRangeAddress[] cras = new CellRangeAddress[nRegions];
for (int i = 0; i < nRegions; i++)
{
cras[i] = new CellRangeAddress(in1);
}
_numberOfRegions = nRegions;
_startIndex = 0;
_regions = cras;
}
开发者ID:missxiaohuang,项目名称:Weekly,代码行数:17,代码来源:MergeCellsRecord.cs
示例5: SetBorderLeft
/**
* Sets the left border for a region of cells by manipulating the cell style of the individual
* cells on the left
*
* @param border The new border
* @param region The region that should have the border
* @param workbook The workbook that the region is on.
* @param sheet The sheet that the region is on.
*/
public static void SetBorderLeft(int border, CellRangeAddress region, ISheet sheet,
IWorkbook workbook)
{
int rowStart = region.FirstRow;
int rowEnd = region.LastRow;
int column = region.FirstColumn;
CellPropertySetter cps = new CellPropertySetter(workbook, CellUtil.BORDER_LEFT, border);
for (int i = rowStart; i <= rowEnd; i++)
{
cps.SetProperty(CellUtil.GetRow(i, sheet), column);
}
}
开发者ID:missxiaohuang,项目名称:Weekly,代码行数:22,代码来源:RegionUtil.cs
示例6: BuildMergedRangesMap
/**
* Creates a map (i.e. two-dimensional array) filled with ranges. Allow fast
* retrieving {@link CellRangeAddress} of any cell, if cell is contained in
* range.
*
* @see #getMergedRange(CellRangeAddress[][], int, int)
*/
public static CellRangeAddress[][] BuildMergedRangesMap(HSSFSheet sheet)
{
CellRangeAddress[][] mergedRanges = new CellRangeAddress[1][];
for ( int m = 0; m < sheet.NumMergedRegions; m++ )
{
CellRangeAddress cellRangeAddress = sheet.GetMergedRegion( m );
int requiredHeight = cellRangeAddress.LastRow + 1;
if ( mergedRanges.Length < requiredHeight )
{
CellRangeAddress[][] newArray = new CellRangeAddress[requiredHeight][];
Array.Copy( mergedRanges, 0, newArray, 0, mergedRanges.Length );
mergedRanges = newArray;
}
for ( int r = cellRangeAddress.FirstRow; r <= cellRangeAddress.LastRow; r++ )
{
int requiredWidth = cellRangeAddress.LastColumn + 1;
CellRangeAddress[] rowMerged = mergedRanges[r];
if ( rowMerged == null )
{
rowMerged = new CellRangeAddress[requiredWidth];
mergedRanges[r] = rowMerged;
}
else
{
int rowMergedLength = rowMerged.Length;
if ( rowMergedLength < requiredWidth )
{
CellRangeAddress[] newRow = new CellRangeAddress[requiredWidth];
Array.Copy(rowMerged, 0, newRow, 0,rowMergedLength );
mergedRanges[r] = newRow;
rowMerged = newRow;
}
}
//Arrays.Fill( rowMerged, cellRangeAddress.FirstColumn, cellRangeAddress.LastColumn + 1, cellRangeAddress );
for (int i = cellRangeAddress.FirstColumn; i < cellRangeAddress.LastColumn + 1; i++)
{
rowMerged[i] = cellRangeAddress;
}
}
}
return mergedRanges;
}
开发者ID:ctddjyds,项目名称:npoi,代码行数:54,代码来源:ExcelToHtmlUtils.cs
示例7: CreateSlowestTests
void CreateSlowestTests(int rowNum, IEnumerable<SlowestTest> slowestTests)
{
rowNum = CreateSummaryHeading("20 Slowest Tests", rowNum);
IRow row = sheet.CreateRow(rowNum++);
row.CreateHeadings(ColAssembly, "Assembly", "Class", "Time (secs)", "Time (hh:mm:ss)", "Test Name");
var range = new CellRangeAddress(row.RowNum, row.RowNum, ColPercent, maxColumnUsed);
sheet.AddMergedRegion(range);
foreach (var t in slowestTests)
{
row = sheet.CreateRow(rowNum++);
row.SetCell(ColAssembly, t.AssemblyFileName);
row.SetCell(ColClass, t.ClassName);
row.SetCell(ColTime, t.DurationInSeconds).Format("0.00").ApplyStyle();
row.SetCell(ColTimeHuman, t.DurationHuman).Alignment(HorizontalAlignment.Right).ApplyStyle();
row.SetCell(ColPercent, t.TestName);
range = new CellRangeAddress(row.RowNum, row.RowNum, ColPercent, maxColumnUsed);
sheet.AddMergedRegion(range);
}
}
开发者ID:PhilipDaniels,项目名称:TestParser,代码行数:20,代码来源:XLSXTestResultSummarySheetWriter.cs
示例8: SetAutoFilter
/// <summary>
/// Enable filtering for a range of cells
/// </summary>
/// <param name="range">the range of cells to filter</param>
public IAutoFilter SetAutoFilter(CellRangeAddress range)
{
InternalWorkbook workbook = _workbook.Workbook;
int sheetIndex = _workbook.GetSheetIndex(this);
NameRecord name = workbook.GetSpecificBuiltinRecord(NameRecord.BUILTIN_FILTER_DB, sheetIndex + 1);
if (name == null)
{
name = workbook.CreateBuiltInName(NameRecord.BUILTIN_FILTER_DB, sheetIndex + 1);
}
int firstRow = range.FirstRow;
// if row was not given when constructing the range...
if (firstRow == -1)
{
firstRow = 0;
}
// The built-in name must consist of a single Area3d Ptg.
Area3DPtg ptg = new Area3DPtg(firstRow, range.LastRow,
range.FirstColumn, range.LastColumn,
false, false, false, false, sheetIndex);
name.NameDefinition = (new Ptg[] { ptg });
AutoFilterInfoRecord r = new AutoFilterInfoRecord();
// the number of columns that have AutoFilter enabled.
int numcols = 1 + range.LastColumn - range.FirstColumn;
r.NumEntries = (short)numcols;
int idx = _sheet.FindFirstRecordLocBySid(DimensionsRecord.sid);
_sheet.Records.Insert(idx, r);
//create a combobox control for each column
HSSFPatriarch p = (HSSFPatriarch)CreateDrawingPatriarch();
for (int col = range.FirstColumn; col <= range.LastColumn; col++)
{
p.CreateComboBox(new HSSFClientAnchor(0, 0, 0, 0,
(short)col, firstRow, (short)(col + 1), firstRow + 1));
}
return new HSSFAutoFilter(this);
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:44,代码来源:HSSFSheet.cs
示例9: SetArrayFormula
/// <summary>
/// Sets array formula to specified region for result.
/// </summary>
/// <param name="formula">text representation of the formula</param>
/// <param name="range">Region of array formula for result</param>
/// <returns>the <see cref="ICellRange{ICell}"/> of cells affected by this change</returns>
public ICellRange<ICell> SetArrayFormula(String formula, CellRangeAddress range)
{
// make sure the formula parses OK first
int sheetIndex = _workbook.GetSheetIndex(this);
Ptg[] ptgs = HSSFFormulaParser.Parse(formula, _workbook, FormulaType.Array, sheetIndex);
ICellRange<ICell> cells = GetCellRange(range);
foreach (HSSFCell c in cells)
{
c.SetCellArrayFormula(range);
}
HSSFCell mainArrayFormulaCell = (HSSFCell)cells.TopLeftCell;
FormulaRecordAggregate agg = (FormulaRecordAggregate)mainArrayFormulaCell.CellValueRecord;
agg.SetArrayFormula(range, ptgs);
return cells;
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:22,代码来源:HSSFSheet.cs
示例10: IsMergedRegion
/// <summary>
/// Checks if the provided region is part of the merged regions.
/// </summary>
/// <param name="mergedRegion">Region searched in the merged regions</param>
/// <returns><c>true</c>, when the region is contained in at least one of the merged regions</returns>
public bool IsMergedRegion(CellRangeAddress mergedRegion)
{
foreach (CellRangeAddress range in _sheet.MergedRecords.MergedRegions)
{
if (range.FirstColumn <= mergedRegion.FirstColumn
&& range.LastColumn >= mergedRegion.LastColumn
&& range.FirstRow <= mergedRegion.FirstRow
&& range.LastRow >= mergedRegion.LastRow)
{
return true;
}
}
return false;
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:19,代码来源:HSSFSheet.cs
示例11: SetBorderBottomOfRegion
/// <summary>
/// Sets the bottom border of region.
/// </summary>
/// <param name="region">The region.</param>
/// <param name="borderType">Type of the border.</param>
/// <param name="color">The color.</param>
public void SetBorderBottomOfRegion(CellRangeAddress region, NPOI.SS.UserModel.BorderStyle borderType, short color)
{
HSSFRegionUtil.SetBottomBorderColor(color, region, this, _workbook);
HSSFRegionUtil.SetBorderBottom(borderType, region, this, _workbook);
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:11,代码来源:HSSFSheet.cs
示例12: GetCellRange
/// <summary>
/// Also creates cells if they don't exist.
/// </summary>
private ICellRange<ICell> GetCellRange(CellRangeAddress range)
{
int firstRow = range.FirstRow;
int firstColumn = range.FirstColumn;
int lastRow = range.LastRow;
int lastColumn = range.LastColumn;
int height = lastRow - firstRow + 1;
int width = lastColumn - firstColumn + 1;
List<ICell> temp = new List<ICell>(height * width);
for (int rowIn = firstRow; rowIn <= lastRow; rowIn++)
{
for (int colIn = firstColumn; colIn <= lastColumn; colIn++)
{
IRow row = GetRow(rowIn);
if (row == null)
{
row = CreateRow(rowIn);
}
ICell cell = row.GetCell(colIn);
if (cell == null)
{
cell = row.CreateCell(colIn);
}
temp.Add(cell);
}
}
return SSCellRange<ICell>.Create(firstRow, firstColumn, height, width, temp, typeof(HSSFCell));
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:31,代码来源:HSSFSheet.cs
示例13: MergeCell
public void MergeCell(int x1,int y1,int x2,int y2)
{
CellRangeAddress range = new CellRangeAddress(y1, y2, x1, x2);
sheet.AddMergedRegion(range);
}
开发者ID:uwitec,项目名称:web-mvc-logistics,代码行数:5,代码来源:XlsExport.cs
示例14: SetEnclosedBorderOfRegion
/// <summary>
/// Sets the enclosed border of region.
/// </summary>
/// <param name="region">The region.</param>
/// <param name="borderType">Type of the border.</param>
/// <param name="color">The color.</param>
public void SetEnclosedBorderOfRegion(CellRangeAddress region, NPOI.SS.UserModel.BorderStyle borderType, short color)
{
HSSFRegionUtil.SetRightBorderColor(color, region, this, _workbook);
HSSFRegionUtil.SetBorderRight(borderType, region, this, _workbook);
HSSFRegionUtil.SetLeftBorderColor(color, region, this, _workbook);
HSSFRegionUtil.SetBorderLeft(borderType, region, this, _workbook);
HSSFRegionUtil.SetTopBorderColor(color, region, this, _workbook);
HSSFRegionUtil.SetBorderTop(borderType, region, this, _workbook);
HSSFRegionUtil.SetBottomBorderColor(color, region, this, _workbook);
HSSFRegionUtil.SetBorderBottom(borderType, region, this, _workbook);
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:17,代码来源:HSSFSheet.cs
示例15: SetRepeatingRowsAndColumns
private void SetRepeatingRowsAndColumns(
CellRangeAddress rowDef, CellRangeAddress colDef)
{
int sheetIndex = _workbook.GetSheetIndex(this);
int maxRowIndex = SpreadsheetVersion.EXCEL97.LastRowIndex;
int maxColIndex = SpreadsheetVersion.EXCEL97.LastColumnIndex;
int col1 = -1;
int col2 = -1;
int row1 = -1;
int row2 = -1;
if (rowDef != null)
{
row1 = rowDef.FirstRow;
row2 = rowDef.LastRow;
if ((row1 == -1 && row2 != -1) || (row1 > row2)
|| (row1 < 0 || row1 > maxRowIndex)
|| (row2 < 0 || row2 > maxRowIndex))
{
throw new ArgumentException("Invalid row range specification");
}
}
if (colDef != null)
{
col1 = colDef.FirstColumn;
col2 = colDef.LastColumn;
if ((col1 == -1 && col2 != -1) || (col1 > col2)
|| (col1 < 0 || col1 > maxColIndex)
|| (col2 < 0 || col2 > maxColIndex))
{
throw new ArgumentException("Invalid column range specification");
}
}
short externSheetIndex =
(short)_workbook.Workbook.CheckExternSheet(sheetIndex);
bool setBoth = rowDef != null && colDef != null;
bool removeAll = rowDef == null && colDef == null;
HSSFName name = _workbook.GetBuiltInName(NameRecord.BUILTIN_PRINT_TITLE, sheetIndex);
if (removeAll)
{
if (name != null)
{
_workbook.RemoveName(name);
}
return;
}
if (name == null)
{
name = _workbook.CreateBuiltInName(
NameRecord.BUILTIN_PRINT_TITLE, sheetIndex);
}
List<Ptg> ptgList = new List<Ptg>();
if (setBoth)
{
int exprsSize = 2 * 11 + 1; // 2 * Area3DPtg.SIZE + UnionPtg.SIZE
ptgList.Add(new MemFuncPtg(exprsSize));
}
if (colDef != null)
{
Area3DPtg colArea = new Area3DPtg(0, maxRowIndex, col1, col2,
false, false, false, false, externSheetIndex);
ptgList.Add(colArea);
}
if (rowDef != null)
{
Area3DPtg rowArea = new Area3DPtg(row1, row2, 0, maxColIndex,
false, false, false, false, externSheetIndex);
ptgList.Add(rowArea);
}
if (setBoth)
{
ptgList.Add(UnionPtg.instance);
}
Ptg[] ptgs = ptgList.ToArray();
//ptgList.toArray(ptgs);
name.SetNameDefinition(ptgs);
HSSFPrintSetup printSetup = (HSSFPrintSetup)PrintSetup;
printSetup.ValidSettings = (false);
SetActive(true);
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:87,代码来源:HSSFSheet.cs
示例16: CopyRow
private static void CopyRow(HSSFSheet srcSheet, HSSFSheet destSheet, HSSFRow srcRow, HSSFRow destRow, IDictionary<Int32, HSSFCellStyle> styleMap, Dictionary<short, short> paletteMap, bool keepFormulas)
{
List<SS.Util.CellRangeAddress> mergedRegions = destSheet.Sheet.MergedRecords.MergedRegions;
destRow.Height = srcRow.Height;
destRow.IsHidden = srcRow.IsHidden;
destRow.RowRecord.OptionFlags = srcRow.RowRecord.OptionFlags;
for (int j = srcRow.FirstCellNum; j <= srcRow.LastCellNum; j++)
{
HSSFCell oldCell = (HSSFCell)srcRow.GetCell(j);
HSSFCell newCell = (HSSFCell)destRow.GetCell(j);
if (srcSheet.Workbook == destSheet.Workbook)
{
newCell = (HSSFCell)destRow.GetCell(j);
}
if (oldCell != null)
{
if (newCell == null)
{
newCell = (HSSFCell)destRow.CreateCell(j);
}
HSSFCellUtil.CopyCell(oldCell, newCell, styleMap, paletteMap, keepFormulas);
CellRangeAddress mergedRegion = GetMergedRegion(srcSheet, srcRow.RowNum, (short)oldCell.ColumnIndex);
if (mergedRegion != null)
{
CellRangeAddress newMergedRegion = new CellRangeAddress(mergedRegion.FirstRow,
mergedRegion.LastRow, mergedRegion.FirstColumn, mergedRegion.LastColumn);
if (IsNewMergedRegion(newMergedRegion, mergedRegions))
{
mergedRegions.Add(newMergedRegion);
}
}
}
}
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:35,代码来源:HSSFSheet.cs
示例17: SetTopBorderColor
/// <summary>
/// Sets the topBorderColor attribute of the HSSFRegionUtil object
/// </summary>
/// <param name="color">The color of the border</param>
/// <param name="region">The region that should have the border</param>
/// <param name="sheet">The sheet that the region is on.</param>
/// <param name="workbook">The workbook that the region is on.</param>
public static void SetTopBorderColor(int color, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook)
{
int colStart = region.FirstColumn;
int colEnd = region.LastColumn;
int rowIndex = region.FirstRow;
CellPropertySetter cps = new CellPropertySetter(workbook, HSSFCellUtil.TOP_BORDER_COLOR, color);
NPOI.SS.UserModel.Row row = HSSFCellUtil.GetRow(rowIndex, sheet);
for (int i = colStart; i <= colEnd; i++)
{
cps.SetProperty(row, i);
}
}
开发者ID:babywzazy,项目名称:Server,代码行数:20,代码来源:HSSFRegionUtil.cs
示例18: ValidateArrayFormulas
private void ValidateArrayFormulas(CellRangeAddress region)
{
int firstRow = region.FirstRow;
int firstColumn = region.FirstColumn;
int lastRow = region.LastRow;
int lastColumn = region.LastColumn;
for (int rowIn = firstRow; rowIn <= lastRow; rowIn++)
{
for (int colIn = firstColumn; colIn <= lastColumn; colIn++)
{
HSSFRow row = (HSSFRow)GetRow(rowIn);
if (row == null) continue;
HSSFCell cell = (HSSFCell)row.GetCell(colIn);
if (cell == null) continue;
if (cell.IsPartOfArrayFormulaGroup)
{
CellRangeAddress arrayRange = cell.ArrayFormulaRange;
if (arrayRange.NumberOfCells > 1 &&
(arrayRange.IsInRange(region.FirstRow, region.FirstColumn) ||
arrayRange.IsInRange(region.FirstRow, region.FirstColumn)))
{
String msg = "The range " + region.FormatAsString() + " intersects with a multi-cell array formula. " +
"You cannot merge cells of an array.";
throw new InvalidOperationException(msg);
}
}
}
}
}
开发者ID:bluebirdtech,项目名称:npoi,代码行数:32,代码来源:HSSFSheet.cs
示例19: SetRightBorderColor
//[Obsolete]
//public static void SetRightBorderColor(short color, Region region, HSSFSheet sheet,
// HSSFWorkbook workbook)
//{
// SetRightBorderColor(color, toCRA(region), sheet, workbook);
//}
/// <summary>
/// Sets the rightBorderColor attribute of the HSSFRegionUtil object
/// </summary>
/// <param name="color">The color of the border</param>
/// <param name="region">The region that should have the border</param>
/// <param name="sheet">The workbook that the region is on.</param>
/// <param name="workbook">The sheet that the region is on.</param>
public static void SetRightBorderColor(int color, CellRangeAddress region, HSSFSheet sheet,
HSSFWorkbook workbook)
{
int rowStart = region.FirstRow;
int rowEnd = region.LastRow;
int column = region.LastColumn;
CellPropertySetter cps = new CellPropertySetter(workbook, HSSFCellUtil.RIGHT_BORDER_COLOR, color);
for (int i = rowStart; i <= rowEnd; i++)
{
cps.SetProperty(HSSFCellUtil.GetRow(i, sheet), column);
}
}
开发者ID:babywzazy,项目名称:Server,代码行数:26,代码来源:HSSFRegionUtil.cs
示例20: ExportDynamicReportHeader
private void ExportDynamicReportHeader(
ref ExportExcelInfo exportExcelInfo,
GetDynamicReportCriteria criteria,
DynamicReportInfo dynamicReport)
{
NpoiExcelExtensions.SetHeaderColorIndex(exportExcelInfo);
ICellStyle headerStyle = NpoiExcelExtensions.GetHeaderStyle(
exportExcelInfo.ExcelFile,
new ExcelStyleParam());
var currentColumn = exportExcelInfo.StartColumn;
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 80 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 100 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 120 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 300 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 160 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 100 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 80 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 140 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 140 * NpoiExcelExtensions.FontWidth);
exportExcelInfo.Worksheet.SetColumnWidth(currentColumn++, 140 * NpoiExcelExtensions.FontWidth);
string reportTitle = string.Format(
Labels.DynamicReport_TitleWithNumberOfLog,
SettingService.GetPeriodTypeName(criteria.ReportType),
DateTimeUtilize.ChangeTimeZoneToClientDateTime(criteria.FromDate).ToShortFormatedDate(),
DateTimeUtilize.ChangeTimeZoneToClientDateTime(criteria.ToDate).ToShortFormatedDate(),
dynamicReport != null ? "[" + dynamicReport.TotalChildReports + "]" : string.Empty);
CellRangeAddress cellRangeAddress;
cellRangeAddress = new CellRangeAddress(
exportExcelInfo.CurrentRow,
exportExcelInfo.CurrentRow + 1,
exportExcelInfo.StartColumn,
exportExcelInfo.MaxColumnIndex);
NpoiExcelExtensions.RenderMergedCells(exportExcelInfo, cellRangeAddress, reportTitle, headerStyle);
exportExcelInfo.CurrentRow += 2;
NpoiExcelExtensions.RenderEmptyRow(exportExcelInfo, exportExcelInfo.CurrentRow);
exportExcelInfo.CurrentRow++;
IRow row = exportExcelInfo.Worksheet.CreateRow(exportExcelInfo.CurrentRow);
currentColumn = exportExcelInfo.StartColumn;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Symbol_No, headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Running_No, headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Feedback_Date, headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(
row,
currentColumn,
string.Format("{0}/{1}", Labels.Main_Category, Labels.Sub_Category),
headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Subject, headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Status, headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Duration, headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Username, headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Handler, headerStyle);
currentColumn++;
NpoiExcelExtensions.RenderCell(row, currentColumn, Labels.Reviewer, headerStyle);
currentColumn++;
exportExcelInfo.CurrentRow++;
}
开发者ID:sakataa,项目名称:CompanyDocument,代码行数:68,代码来源:PagingMultilevel.cs
注:本文中的CellRangeAddress类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论