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


C# IWorkbook.GetCreationHelper方法代码示例

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


在下文中一共展示了IWorkbook.GetCreationHelper方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: buildWorkbook

        private void buildWorkbook(IWorkbook wb)
        {
            ISheet sh = wb.CreateSheet();
            IRow row1 = sh.CreateRow(0);
            IRow row2 = sh.CreateRow(1);
            row3 = sh.CreateRow(2);

            row1.CreateCell(0, CellType.Numeric);
            row1.CreateCell(1, CellType.Numeric);

            row2.CreateCell(0, CellType.Numeric);
            row2.CreateCell(1, CellType.Numeric);

            row3.CreateCell(0);
            row3.CreateCell(1);

            CellReference a1 = new CellReference("A1");
            CellReference a2 = new CellReference("A2");
            CellReference b1 = new CellReference("B1");
            CellReference b2 = new CellReference("B2");

            sh.GetRow(a1.Row).GetCell(a1.Col).SetCellValue(35);
            sh.GetRow(a2.Row).GetCell(a2.Col).SetCellValue(0);
            sh.GetRow(b1.Row).GetCell(b1.Col).CellFormula = (/*setter*/"A1/A2");
            sh.GetRow(b2.Row).GetCell(b2.Col).CellFormula = (/*setter*/"NA()");

            Evaluator = wb.GetCreationHelper().CreateFormulaEvaluator();
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:28,代码来源:TestLogicalFunction.cs

示例2: EvaluateWorkbook

     // TODO should we have this stuff in the FormulaEvaluator?
     private void EvaluateWorkbook(IWorkbook workbook){
     IFormulaEvaluator eval = workbook.GetCreationHelper().CreateFormulaEvaluator();
     for(int i=0; i < workbook.NumberOfSheets; i++) {
         ISheet sheet = workbook.GetSheetAt(i);
         IEnumerator rows = sheet.GetRowEnumerator();
         for (IRow r = null; rows.MoveNext(); )
         {
             r = (IRow)rows.Current;
             foreach (ICell c in r)
             {
                 if (c.CellType == CellType.FORMULA)
                 {
                     eval.EvaluateFormulaCell(c);
                 }
             }
         }
     }
 }
开发者ID:WPG,项目名称:npoi,代码行数:19,代码来源:BaseTestSheetAutosizeColumn.cs

示例3: EvaluateCell

 private ICell EvaluateCell(IWorkbook wb, ICell c)
 {
     ISheet s = c.Sheet;
     wb.GetCreationHelper().CreateFormulaEvaluator().EvaluateFormulaCell(c);
     return s.GetRow(c.RowIndex).GetCell(c.ColumnIndex);
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:6,代码来源:BaseTestBugzillaIssues.cs

示例4: EvaluateAllFormulaCells

 /**
    * Loops over all cells in all sheets of the supplied
    *  workbook.
    * For cells that contain formulas, their formulas are
    *  evaluated, and the results are saved. These cells
    *  remain as formula cells.
    * For cells that do not contain formulas, no changes
    *  are made.
    * This is a helpful wrapper around looping over all
    *  cells, and calling evaluateFormulaCell on each one.
    */
 public static void EvaluateAllFormulaCells(IWorkbook wb)
 {
     IFormulaEvaluator evaluator = wb.GetCreationHelper().CreateFormulaEvaluator();
     EvaluateAllFormulaCells(wb, evaluator);
 }
开发者ID:xiepeixing,项目名称:npoi,代码行数:16,代码来源:HSSFFormulaEvaluator.cs

示例5: handleResize

        private void handleResize(IWorkbook wb, ISheet sheet, IRow row)
        {
            IDrawing Drawing = sheet.CreateDrawingPatriarch();
            ICreationHelper CreateHelper = wb.GetCreationHelper();

            byte[] bytes = HSSFITestDataProvider.Instance.GetTestDataFileContent("logoKarmokar4.png");

            row.HeightInPoints = (/*setter*/GetImageSize(bytes).Y);

            int pictureIdx = wb.AddPicture(bytes, PictureType.PNG);

            //add a picture shape
            IClientAnchor anchor = CreateHelper.CreateClientAnchor();
            //set top-left corner of the picture,
            //subsequent call of Picture#resize() will operate relative to it
            anchor.Col1 = (/*setter*/0);
            anchor.Row1 = (/*setter*/0);

            IPicture pict = Drawing.CreatePicture(anchor, pictureIdx);

            //auto-size picture relative to its top-left corner
            pict.Resize();
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:23,代码来源:BaseTestPicture.cs

示例6: EvaluateWorkbook

 // TODO should we have this stuff in the FormulaEvaluator?
 private void EvaluateWorkbook(IWorkbook workbook)
 {
     IFormulaEvaluator eval = workbook.GetCreationHelper().CreateFormulaEvaluator();
     for (int i = 0; i < workbook.NumberOfSheets; i++)
     {
         ISheet sheet = workbook.GetSheetAt(i);
         foreach (IRow r in sheet)
         {
             foreach (ICell c in r)
             {
                 if (c.CellType == CellType.Formula)
                 {
                     eval.EvaluateFormulaCell(c);
                 }
             }
         }
     }
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:19,代码来源:BaseTestSheetAutosizeColumn.cs

示例7: PostilAdd

        private static void PostilAdd(Tk5ListMetaData metaInfos, ImportError importError, IWorkbook workBook, ISheet sheet)
        {
            IDrawing part = sheet.CreateDrawingPatriarch();
            Dictionary<string, int> indexOfName = new Dictionary<string, int>();
            int i = 0;

            foreach (var info in metaInfos.Table.TableList)
            {
                indexOfName.Add(info.DisplayName, i);
                i++;
            }

            foreach (var err in importError)
            {
                IRow row = sheet.GetRow(err.IndexOfRow);
                IComment comment = null;
                ICell cell = row.GetCell(indexOfName[err.ColumnName]);
                ICreationHelper factory = workBook.GetCreationHelper();
                IClientAnchor anchor = null;
                anchor = factory.CreateClientAnchor();
                anchor.Col1 = cell.ColumnIndex + 2;
                anchor.Col2 = cell.ColumnIndex + 4;
                anchor.Row1 = row.RowNum;
                anchor.Row2 = row.RowNum + 3;
                comment = part.CreateCellComment(anchor);
                comment.Author = "mitu";
                comment.String = new HSSFRichTextString(err.ErrorMsg);
                cell.CellComment = comment;
            }
        }
开发者ID:ZLLselfRedeem,项目名称:zllinmitu,代码行数:30,代码来源:ExcelUtil.cs

示例8: TestMissingWorkbookMissingOverride

        public void TestMissingWorkbookMissingOverride()
        {
            mainWorkbook = HSSFTestDataSamples.OpenSampleWorkbook(MAIN_WORKBOOK_FILENAME);
            ISheet lSheet = mainWorkbook.GetSheetAt(0);
            ICell lA1Cell = lSheet.GetRow(0).GetCell(0);
            ICell lB1Cell = lSheet.GetRow(1).GetCell(0);
            ICell lC1Cell = lSheet.GetRow(2).GetCell(0);

            Assert.AreEqual(CellType.Formula, lA1Cell.CellType);
            Assert.AreEqual(CellType.Formula, lB1Cell.CellType);
            Assert.AreEqual(CellType.Formula, lC1Cell.CellType);

            // Check cached values
            Assert.AreEqual(10.0d, lA1Cell.NumericCellValue, 0.00001d);
            Assert.AreEqual("POI rocks!", lB1Cell.StringCellValue);
            Assert.AreEqual(true, lC1Cell.BooleanCellValue);

            // Evaluate
            IFormulaEvaluator evaluator = mainWorkbook.GetCreationHelper().CreateFormulaEvaluator();
            evaluator.IgnoreMissingWorkbooks = (true);

            Assert.AreEqual(CellType.Numeric, evaluator.EvaluateFormulaCell(lA1Cell));
            Assert.AreEqual(CellType.String, evaluator.EvaluateFormulaCell(lB1Cell));
            Assert.AreEqual(CellType.Boolean, evaluator.EvaluateFormulaCell(lC1Cell));

            Assert.AreEqual(10.0d, lA1Cell.NumericCellValue, 0.00001d);
            Assert.AreEqual("POI rocks!", lB1Cell.StringCellValue);
            Assert.AreEqual(true, lC1Cell.BooleanCellValue);
        }
开发者ID:newlysoft,项目名称:npoi,代码行数:29,代码来源:TestMissingWorkbook.cs


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