本文整理汇总了C#中ISheet类的典型用法代码示例。如果您正苦于以下问题:C# ISheet类的具体用法?C# ISheet怎么用?C# ISheet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISheet类属于命名空间,在下文中一共展示了ISheet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:chuckfrazier,项目名称:DataPlatform,代码行数:25,代码来源:ServiceLineExplorerExplorerExcelExporter.cs
示例2: NpoiWorksheet
public NpoiWorksheet(HSSFWorkbook book, ISheet sheet) {
sheet.ForceFormulaRecalculation = true;
Book = book;
Sheet = sheet;
Index = book.GetSheetIndex(sheet);
Name = book.GetSheetName(Index);
}
开发者ID:manologomez,项目名称:ISpreadsheet.net,代码行数:7,代码来源:NpoiWorksheet.cs
示例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;
}
开发者ID:OsamaRazaAnsari,项目名称:2DDressUpGame,代码行数:27,代码来源:ExcelParser.cs
示例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);
}
开发者ID:baptisteMillot,项目名称:Synoptique,代码行数:7,代码来源:GetPageDeGarde.cs
示例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);
}
开发者ID:baptisteMillot,项目名称:Synoptique,代码行数:7,代码来源:GetPageDeGarde.cs
示例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;
}
}
开发者ID:gvassas,项目名称:Hatfield.EnviroData.MVC,代码行数:25,代码来源:SpreadsheetHelper.cs
示例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);
}
开发者ID:xoposhiy,项目名称:npoi,代码行数:26,代码来源:NumberComparingSpreadsheetGenerator.cs
示例8: PositionnementEtudeCreator
public PositionnementEtudeCreator(ISheet sheet, XSSFWorkbook workbook)
{
_sheet = sheet;
_workbook = workbook;
_cadreCreator = new Cadre(workbook, sheet);
_lineCreator = new DataLineStyle(workbook, sheet);
}
开发者ID:baptisteMillot,项目名称:Synoptique,代码行数:7,代码来源:PositionnementEtudeCreator.cs
示例9: CadrePA
public CadrePA(ISheet sheet, XSSFWorkbook workbook)
{
_sheet = sheet;
_workbook = workbook;
_lineCreator = new DataLineStyle(workbook, sheet);
_cadreCreator = new Cadre(workbook, sheet);
}
开发者ID:baptisteMillot,项目名称:Synoptique,代码行数:7,代码来源:CadrePA.cs
示例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);
}
开发者ID:Reinakumiko,项目名称:npoi,代码行数:27,代码来源:Program.cs
示例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");
}
开发者ID:KzoNag,项目名称:unity-github-test,代码行数:26,代码来源:ExcelExporter.cs
示例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));
}
}
开发者ID:ChrizLee,项目名称:excel-it,代码行数:25,代码来源:Writer.cs
示例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;
}
开发者ID:sloww,项目名称:tslinkcn.tools,代码行数:29,代码来源:PublicTools.cs
示例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;
}
}
}
开发者ID:konglinghai123,项目名称:SAS,代码行数:36,代码来源:ExcelHelper.cs
示例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);
}
}
}
开发者ID:chuckfrazier,项目名称:DataPlatform,代码行数:26,代码来源:ServiceLineExplorerExplorerExcelExporter.cs
示例16: SameCell
/**
* Highlight cells based on their values
*/
static void SameCell(ISheet sheet)
{
sheet.CreateRow(0).CreateCell(0).SetCellValue(84);
sheet.CreateRow(1).CreateCell(0).SetCellValue(74);
sheet.CreateRow(2).CreateCell(0).SetCellValue(50);
sheet.CreateRow(3).CreateCell(0).SetCellValue(51);
sheet.CreateRow(4).CreateCell(0).SetCellValue(49);
sheet.CreateRow(5).CreateCell(0).SetCellValue(41);
ISheetConditionalFormatting sheetCF = sheet.SheetConditionalFormatting;
// Condition 1: Cell Value Is greater than 70 (Blue Fill)
IConditionalFormattingRule rule1 = sheetCF.CreateConditionalFormattingRule(ComparisonOperator.GreaterThan, "70");
IPatternFormatting fill1 = rule1.CreatePatternFormatting();
fill1.FillBackgroundColor = (IndexedColors.Blue.Index);
fill1.FillPattern = (short)FillPattern.SolidForeground;
// Condition 2: Cell Value Is less than 50 (Green Fill)
IConditionalFormattingRule rule2 = sheetCF.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "50");
IPatternFormatting fill2 = rule2.CreatePatternFormatting();
fill2.FillBackgroundColor = (IndexedColors.Green.Index);
fill2.FillPattern= (short)FillPattern.SolidForeground;
CellRangeAddress[] regions = {
CellRangeAddress.ValueOf("A1:A6")
};
sheetCF.AddConditionalFormatting(regions, rule1, rule2);
sheet.GetRow(0).CreateCell(2).SetCellValue("<== Condition 1: Cell Value is greater than 70 (Blue Fill)");
sheet.GetRow(4).CreateCell(2).SetCellValue("<== Condition 2: Cell Value is less than 50 (Green Fill)");
}
开发者ID:89sos98,项目名称:npoi,代码行数:35,代码来源:Program.cs
示例17: Init
public bool Init()
{
if (!File.Exists(m_StrategyName))
{
m_StrategyWorkBook = new XSSFWorkbook();
m_StrategySheet = (ISheet)m_StrategyWorkBook.CreateSheet("Sheet1");
IRow Row = m_StrategySheet.CreateRow(0);
Row.CreateCell(0).SetCellValue("-500");
Row.CreateCell(1).SetCellValue("-450");
Row.CreateCell(2).SetCellValue("-400");
Row.CreateCell(3).SetCellValue("-350");
Row.CreateCell(4).SetCellValue("-300");
Row.CreateCell(5).SetCellValue("-250");
Row.CreateCell(6).SetCellValue("-200");
Row.CreateCell(7).SetCellValue("-150");
Row.CreateCell(8).SetCellValue("-100");
Row.CreateCell(9).SetCellValue("-50");
Row.CreateCell(10).SetCellValue("0");
Row.CreateCell(11).SetCellValue("50");
Row.CreateCell(12).SetCellValue("100");
Row.CreateCell(13).SetCellValue("150");
Row.CreateCell(14).SetCellValue("200");
Row.CreateCell(15).SetCellValue("250");
Row.CreateCell(16).SetCellValue("300");
Row.CreateCell(17).SetCellValue("350");
Row.CreateCell(18).SetCellValue("400");
Row.CreateCell(19).SetCellValue("450");
Row.CreateCell(20).SetCellValue("500");
return true;
}
return false;
}
开发者ID:s850042002,项目名称:ostock-simulation,代码行数:33,代码来源:SpotExcel.cs
示例18: SheetImport
private static void SheetImport(Tk5ListMetaData metaInfos, DataTable dataTable, ISheet sheet,
ResultHolder resultHolder)
{
if (sheet != null)
{
// resultHolder.SheetName = metaInfos.Table.TableDesc;
Dictionary<string, Tk5FieldInfoEx> dicOfInfo = new Dictionary<string, Tk5FieldInfoEx>();
foreach (Tk5FieldInfoEx info in metaInfos.Table.TableList)
{
dicOfInfo.Add(info.DisplayName, info);
}
IRow headerRow = sheet.GetRow(0);
for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++)
{
IRow row = sheet.GetRow(i);
DataRow dataRow = dataTable.NewRow();
for (int j = row.FirstCellNum; j < row.LastCellNum; j++)
{
string columnName = headerRow.GetCell(j).ToString();
string strValue = row.GetCell(j).ToString();
ImportResult imResult = TablePadding(dataRow, columnName, dicOfInfo, strValue, i);
if (imResult != null)
{
resultHolder.Add(imResult);
}
}
dataTable.Rows.Add(dataRow);
}
}
}
开发者ID:ZLLselfRedeem,项目名称:zllinmitu,代码行数:31,代码来源:NPOIRead.cs
示例19: WorkSheet
internal WorkSheet(IWorkbook bookHandler, ISheet sheetHandler)
{
this.bookHandler = bookHandler;
this.sheetHandler = sheetHandler;
this.Cells = new CellCollection() { Sheet = this };
}
开发者ID:vjine,项目名称:NPOI.Wrapper,代码行数:7,代码来源:WorkSheet.cs
示例20: AddToExcel
static void AddToExcel(ISheet _sheet, CharaData _data, int _rowIdx)
{
IRow row = _sheet.CreateRow(_rowIdx);
int cellIdx = 1;
// name
ICell nameCell = row.CreateCell(cellIdx++);
nameCell.SetCellValue(_data.m_name);
// hp
ICell hpCell = row.CreateCell(cellIdx++);
hpCell.SetCellValue(_data.m_hp);
// x
ICell posxCell = row.CreateCell(cellIdx++);
posxCell.SetCellValue(_data.m_position.x);
// y
ICell posyCell = row.CreateCell(cellIdx++);
posyCell.SetCellValue(_data.m_position.y);
// z
ICell poszCell = row.CreateCell(cellIdx++);
poszCell.SetCellValue(_data.m_position.z);
}
开发者ID:KzoNag,项目名称:unity-github-test,代码行数:26,代码来源:ExcelExporter.cs
注:本文中的ISheet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论