本文整理汇总了C#中ISheet类的典型用法代码示例。如果您正苦于以下问题:C# ISheet类的具体用法?C# ISheet怎么用?C# ISheet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISheet类属于命名空间,在下文中一共展示了ISheet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDateRangetoExcelSheet
public void AddDateRangetoExcelSheet(HSSFWorkbook workbook, ISheet sheet)
{
//Create a Title row
var titleFont = workbook.CreateFont();
titleFont.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold;
titleFont.FontHeightInPoints = 11;
titleFont.Underline = NPOI.SS.UserModel.FontUnderlineType.Single;
var titleStyle = workbook.CreateCellStyle();
titleStyle.SetFont(titleFont);
var row = sheet.CreateRow(rowCount++);
var cell = row.CreateCell(0);
cell.CellStyle = titleStyle;
cell.SetCellValue("Date Range");
row = sheet.CreateRow(rowCount++);
cell = row.CreateCell(0);
var value = string.Format("Start Date: {0}", StartDate.ToString("MM-dd-yyyy"));
cell.SetCellValue(value);
row = sheet.CreateRow(rowCount++);
cell = row.CreateCell(0);
value = string.Format("End Date: {0}", EndDate.ToString("MM-dd-yyyy"));
cell.SetCellValue(value);
}
示例2: NpoiWorksheet
public NpoiWorksheet(HSSFWorkbook book, ISheet sheet) {
sheet.ForceFormulaRecalculation = true;
Book = book;
Sheet = sheet;
Index = book.GetSheetIndex(sheet);
Name = book.GetSheetName(Index);
}
示例3: ReadSheet
//シートの読み込み
static StringGrid ReadSheet(ISheet sheet, string path)
{
int lastRowNum = sheet.LastRowNum;
StringGrid grid = new StringGrid(path + ":" + sheet.SheetName, CsvType.Tsv);
for (int rowIndex = sheet.FirstRowNum; rowIndex <= lastRowNum; ++rowIndex)
{
IRow row = sheet.GetRow(rowIndex);
List<string> stringList = new List<string>();
if (row != null)
{
foreach (var cell in row.Cells)
{
for (int i = stringList.Count; i < cell.ColumnIndex; ++i)
{
stringList.Add("");
}
stringList.Add(cell.ToString());
}
}
grid.AddRow(stringList);
}
grid.ParseHeader();
return grid;
}
示例4: GetChambrePMZ
private ChambrePA GetChambrePMZ(ISheet sheet)
{
var geofibrePMZ = sheet.GetRow(10).GetCell(11).ToString();
var identifiantPMZ = sheet.GetRow(10).GetCell(13).ToString();
return new ChambrePA(geofibrePMZ, identifiantPMZ);
}
示例5: GetChambrePA
private ChambrePointAboutement GetChambrePA(ISheet sheet)
{
var geofibrePA = sheet.GetRow(11).GetCell(11).ToString();
var chambrePA = sheet.GetRow(13).GetCell(10).ToString();
return new ChambrePointAboutement(geofibrePA, chambrePA);
}
示例6: OutputDateRow
private static void OutputDateRow(ISheet sheet, IEnumerable<string> distinctDates, int rowIndex)
{
var colSpan = 3;
var startCol = 1;
var dateRow = sheet.CreateRow(rowIndex);
var headerRow = sheet.CreateRow(rowIndex + 1);
dateRow.CreateCell(0).SetCellValue("");
headerRow.CreateCell(0).SetCellValue("");
for (var i = 0; i < distinctDates.Count(); i++)
{
var cell = dateRow.CreateCell(startCol);
cell.SetCellValue(distinctDates.ElementAt(i));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, startCol, colSpan * (i + 1)));
headerRow.CreateCell(startCol).SetCellValue(ValueHeader);
headerRow.CreateCell(startCol + 1).SetCellValue(PrefixHeader);
headerRow.CreateCell(startCol + 2).SetCellValue(DlHeader);
startCol = startCol + colSpan;
}
}
示例7: WriteHeaderRow
static void WriteHeaderRow(IWorkbook wb, ISheet sheet)
{
sheet.SetColumnWidth(0, 6000);
sheet.SetColumnWidth(1, 6000);
sheet.SetColumnWidth(2, 3600);
sheet.SetColumnWidth(3, 3600);
sheet.SetColumnWidth(4, 2400);
sheet.SetColumnWidth(5, 2400);
sheet.SetColumnWidth(6, 2400);
sheet.SetColumnWidth(7, 2400);
sheet.SetColumnWidth(8, 2400);
IRow row = sheet.CreateRow(0);
ICellStyle style = wb.CreateCellStyle();
IFont font = wb.CreateFont();
font.Boldweight = (short)FontBoldWeight.BOLD;
style.SetFont(font);
WriteHeaderCell(row, 0, "Raw Long Bits A", style);
WriteHeaderCell(row, 1, "Raw Long Bits B", style);
WriteHeaderCell(row, 2, "Value A", style);
WriteHeaderCell(row, 3, "Value B", style);
WriteHeaderCell(row, 4, "Exp Cmp", style);
WriteHeaderCell(row, 5, "LT", style);
WriteHeaderCell(row, 6, "EQ", style);
WriteHeaderCell(row, 7, "GT", style);
WriteHeaderCell(row, 8, "Check", style);
}
示例8: PositionnementEtudeCreator
public PositionnementEtudeCreator(ISheet sheet, XSSFWorkbook workbook)
{
_sheet = sheet;
_workbook = workbook;
_cadreCreator = new Cadre(workbook, sheet);
_lineCreator = new DataLineStyle(workbook, sheet);
}
示例9: CadrePA
public CadrePA(ISheet sheet, XSSFWorkbook workbook)
{
_sheet = sheet;
_workbook = workbook;
_lineCreator = new DataLineStyle(workbook, sheet);
_cadreCreator = new Cadre(workbook, sheet);
}
示例10: CreateChart
static void CreateChart(IDrawing drawing, ISheet sheet, IClientAnchor anchor, string serie1, string serie2)
{
IChart chart = drawing.CreateChart(anchor);
IChartLegend legend = chart.GetOrCreateLegend();
legend.Position = LegendPosition.TopRight;
ILineChartData<double, double> data = chart.ChartDataFactory.CreateLineChartData<double, double>();
// Use a category axis for the bottom axis.
IChartAxis bottomAxis = chart.ChartAxisFactory.CreateCategoryAxis(AxisPosition.Bottom);
IValueAxis leftAxis = chart.ChartAxisFactory.CreateValueAxis(AxisPosition.Left);
leftAxis.Crosses = AxisCrosses.AutoZero;
IChartDataSource<double> xs = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(0, 0, 0, NUM_OF_COLUMNS - 1));
IChartDataSource<double> ys1 = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(1, 1, 0, NUM_OF_COLUMNS - 1));
IChartDataSource<double> ys2 = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(2, 2, 0, NUM_OF_COLUMNS - 1));
var s1 = data.AddSeries(xs, ys1);
s1.SetTitle(serie1);
var s2 = data.AddSeries(xs, ys2);
s2.SetTitle(serie2);
chart.Plot(data, bottomAxis, leftAxis);
}
示例11: CreateHeaderRow
static void CreateHeaderRow(ISheet _sheet)
{
IRow header = _sheet.CreateRow(1);
int cellIdx = 1;
// name
ICell nameCell = header.CreateCell(cellIdx++);
nameCell.SetCellValue("name");
// hp
ICell hpCell = header.CreateCell(cellIdx++);
hpCell.SetCellValue("hp");
// x
ICell posxCell = header.CreateCell(cellIdx++);
posxCell.SetCellValue("x");
// y
ICell posyCell = header.CreateCell(cellIdx++);
posyCell.SetCellValue("y");
// z
ICell poszCell = header.CreateCell(cellIdx++);
poszCell.SetCellValue("z");
}
示例12: WriteData
public void WriteData(ISheet sheet, object model, IList<Property> properties)
{
var singleVals = new List<Property>();
var listVals = new List<Property>();
foreach (var p in properties)
{
if (p.IsArray)
{
listVals.Add(p);
}
else
{
singleVals.Add(p);
}
}
foreach (var singleProp in singleVals)
{
WriteSingle(sheet, singleProp.RowIndex, singleProp.ColumnIndex, GetPropertyVal(model, singleProp.Name));
}
foreach (var listProp in listVals)
{
WriteArray(sheet, listProp.RowIndex, listProp.ColumnIndex, GetPropertyVals(model, listProp.Name));
}
}
示例13: GetCellNumic
public static double GetCellNumic(ISheet sheet, char x, int y)
{
double _r = double.MinValue;
ICell cell = sheet.GetRow(y - 1).GetCell(GetCellIntFromChar(x) - 1);
if (cell != null)
switch (cell.CellType)
{
case CellType.String:
{
_r = double.Parse(cell.StringCellValue.Trim());
}
break;
case CellType.Numeric:
{
_r = cell.NumericCellValue;
}
break;
default:
{
}
break;
}
return _r;
}
示例14: AddBorder
/// <summary>
/// 加边框
/// </summary>
/// <param Name="rowindex">1开始</param>
/// <param Name="cellIndex">1开始</param>
public void AddBorder( ISheet sheet, HSSFWorkbook workbook)
{
ICellStyle styel = workbook.CreateCellStyle();
styel.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; // ------------------
IFont font1 = workbook.CreateFont();
font1.FontHeightInPoints = 11;
font1.Boldweight = 600;
font1.FontName = "宋体";
styel.SetFont(font1);
for (int rowindex=1;rowindex<sheet.LastRowNum+1;rowindex++)
{
for (int cellIndex =0; cellIndex < dcs.Count;cellIndex++ )
{
sheet.GetRow(rowindex).RowStyle = styel;
ICell cell = sheet.GetRow(rowindex ).GetCell(cellIndex );
HSSFCellStyle Style = workbook.CreateCellStyle() as HSSFCellStyle;
Style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
Style.VerticalAlignment = VerticalAlignment.Center;
Style.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
Style.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
Style.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
Style.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
Style.DataFormat = 0;
Style.SetFont(font1);
cell.CellStyle = Style;
}
}
}
示例15: AddListToExcelSheet
public void AddListToExcelSheet(HSSFWorkbook workbook, ISheet sheet, string Title, Dictionary<string, bool> list)
{
//Create a Title row
var titleFont = workbook.CreateFont();
titleFont.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold;
titleFont.FontHeightInPoints = 11;
titleFont.Underline = NPOI.SS.UserModel.FontUnderlineType.Single;
var titleStyle = workbook.CreateCellStyle();
titleStyle.SetFont(titleFont);
var row = sheet.CreateRow(rowCount++);
row = sheet.CreateRow(rowCount++);
var cell = row.CreateCell(0);
cell.CellStyle = titleStyle;
cell.SetCellValue(Title);
foreach (var org in list)
{
if (org.Value == true)
{
row = sheet.CreateRow(rowCount++);
cell = row.CreateCell(0);
cell.SetCellValue(org.Key);
}
}
}