当前位置: 首页>>代码示例>>C#>>正文


C# ISheet.CreateRow方法代码示例

本文整理汇总了C#中ISheet.CreateRow方法的典型用法代码示例。如果您正苦于以下问题:C# ISheet.CreateRow方法的具体用法?C# ISheet.CreateRow怎么用?C# ISheet.CreateRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISheet的用法示例。


在下文中一共展示了ISheet.CreateRow方法的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);
        }
开发者ID:chuckfrazier,项目名称:DataPlatform,代码行数:25,代码来源:ServiceLineExplorerExplorerExcelExporter.cs

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: CreateDataRow

        // convenient access to namespace
        //private static ErrorEval EE = null;

        private static void CreateDataRow(ISheet sheet, int rowIndex, params double[] vals)
        {
            IRow row = sheet.CreateRow(rowIndex);
            for (int i = 0; i < vals.Length; i++)
            {
                row.CreateCell(i).SetCellValue(vals[i]);
            }
        }
开发者ID:89sos98,项目名称:npoi,代码行数:11,代码来源:TestIndirect.cs

示例9: CreateBody

 // 创建 Excel 内容主体
 private void CreateBody(ISheet sheet, IEnumerable<object[]> columnDatas)
 {
     var i = 1;  // 第二行开始
     foreach (var data in columnDatas)
     {
         var row = sheet.CreateRow(i++);
         this.CreateRow(row, data);
     }
 }
开发者ID:yangganggood,项目名称:EMP,代码行数:10,代码来源:ExcelWriter.cs

示例10: CreateRows

 public void CreateRows(int rowsCount, int cellsCount, ref ISheet sheet, IList<string> cellsValues = null)
 {
     if (sheet == null) return;
     for (var i = 1; i <= rowsCount; i++)
     {
         var r = sheet.CreateRow(i);
         CreateCells(cellsCount, ref r, cellsValues);
     }
 }
开发者ID:adamsabri,项目名称:Security,代码行数:9,代码来源:BaseWriter.cs

示例11: AddDataToReport

        private void AddDataToReport(ISheet worksheet, DefaultExceptionScheduleReportData[] items, bool isDefault = true)
        {
            var rowIndex = worksheet.LastRowNum + 1;

            var dateTitle = DateTime.MinValue;

            foreach (var item in items)
            {
                IRow row;

                if (isDefault)
                {
                    row = worksheet.CreateRow(rowIndex++);

                    WriteCell(row, 0, c => c.SetCellValue(item.ScheduleDate.ToShortDateString()));
                }
                else
                {
                    if (dateTitle != item.ScheduleDate)
                    {
                        dateTitle = item.ScheduleDate;

                        row = worksheet.CreateRow(rowIndex++);

                        WriteCell(row, 0, c => c.SetCellValue(dateTitle.ToShortDateString()), styles[StandardCellStyles.BoldStyle]);
                    }

                    row = worksheet.CreateRow(rowIndex++);

                    WriteCell(row, 0, c => c.SetCellValue((item as ServiceExceptionScheduleReportData).Service));
                }

                WriteCell(row, 1, c => c.SetCellValue(item.IsWorked ? "Да" : "Нет"));

                if (item.IsWorked)
                {
                    WriteCell(row, 2, c => c.SetCellValue(item.StartTime.ToString()));
                    WriteCell(row, 3, c => c.SetCellValue(item.FinishTime.ToString()));
                    WriteCell(row, 4, c => c.SetCellValue(item.ClientInterval.Minutes));
                    WriteCell(row, 5, c => c.SetCellValue(item.Intersection.Minutes));
                    WriteCell(row, 6, c => c.SetCellValue(item.MaxClientRequests));
                }
            };
        }
开发者ID:breslavsky,项目名称:queue,代码行数:44,代码来源:ExceptionScheduleReport.cs

示例12: CreateRowHeader

 /// <summary>
 /// sheet 抬头
 /// </summary>
 /// <param name="sheet">sheet 对象</param>
 private void CreateRowHeader(ISheet sheet)
 {
     var row = sheet.CreateRow(0);
     for (var i = 0; i < this._columnNames.Length; i++)
     {
         var cell = row.CreateCell(i);
         this.WriteToCell(cell, typeof(string), this._columnNames[i]);
     }
     this.CreateRow(row, this._columnNames, false);
 }
开发者ID:yangganggood,项目名称:ReportMS,代码行数:14,代码来源:ExcelRecord.cs

示例13: GenerateRow

 static void GenerateRow(ISheet sheet1,int rowid,string firstName, string lastName, double salaryAmount, double taxRate)
 {
     IRow row = sheet1.CreateRow(rowid);
     row.CreateCell(0).SetCellValue(firstName);  //A2
     row.CreateCell(1).SetCellValue(lastName);   //B2
     row.CreateCell(2).SetCellValue(salaryAmount);   //C2
     row.CreateCell(3).SetCellValue(taxRate);        //D2
     row.CreateCell(4).SetCellFormula(string.Format("C{0}*D{0}",rowid+1));
     row.CreateCell(5).SetCellFormula(string.Format("C{0}-E{0}", rowid + 1));
 }
开发者ID:hjlfmy,项目名称:npoi,代码行数:10,代码来源:Program.cs

示例14: CreateCellArray

 static void CreateCellArray(ISheet sheet)
 {
     for (int i = 0; i < 300; i++)
     {
         IRow row=sheet.CreateRow(i);
         for (int j = 0; j < 150; j++)
         {
             ICell cell = row.CreateCell(j);
             cell.SetCellValue(i*j);
         }
     }
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:12,代码来源:Program.cs

示例15: CreateHeader

        private static void CreateHeader(ISheet workSheet, IEnumerable<Cell> cells)
        {
            var header = workSheet.CreateRow(0);

            var currentCol = 0;

            foreach (var cell in cells)
            {
                header.CreateCell(currentCol).SetCellValue(cell.Title);
                currentCol++;
            }
        }
开发者ID:ErikXu,项目名称:CommonLibrary,代码行数:12,代码来源:ExcelUtil.cs


注:本文中的ISheet.CreateRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。