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


C# IWorkbook.GetType方法代码示例

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


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

示例1: WriteOutAndReadBack

 public static IWorkbook WriteOutAndReadBack(IWorkbook wb)
 {
     IWorkbook result;
     try
     {
         using (MemoryStream baos = new MemoryStream(8192))
         {
             wb.Write(baos);
             using (Stream is1 = new MemoryStream(baos.ToArray()))
             {
                 if (wb is HSSFWorkbook)
                 {
                     result = new HSSFWorkbook(is1);
                 }
                 else if (wb is XSSFWorkbook)
                 {
                     result = new XSSFWorkbook(is1);
                 }
                 else
                 {
                     throw new RuntimeException("Unexpected workbook type ("
                             + wb.GetType().Name + ")");
                 }
             }
         }
     }
     catch (IOException e)
     {
         throw new RuntimeException(e);
     }
     return result;
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:32,代码来源:XSSFTestDataSamples.cs

示例2: WriteOutAndReadBack

 public IWorkbook WriteOutAndReadBack(IWorkbook original)
 {
     if (!(original is XSSFWorkbook))
     {
         throw new ArgumentException("Expected an instance of XSSFWorkbook, but had " + original.GetType().Name);
     }
     return XSSFTestDataSamples.WriteOutAndReadBack((XSSFWorkbook)original);
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:8,代码来源:XSSFITestDataProvider.cs

示例3: CreateEvaluationWorkbook

 private static IEvaluationWorkbook CreateEvaluationWorkbook(IWorkbook wb)
 {
     if (wb is HSSFWorkbook)
     {
         return HSSFEvaluationWorkbook.Create((HSSFWorkbook)wb);
     }
     // TODO rearrange POI build to allow this
     //		if (wb is XSSFWorkbook) {
     //			return XSSFEvaluationWorkbook.Create((XSSFWorkbook) wb);
     //		}
     throw new ArgumentException("Unexpected workbook type (" + wb.GetType().Name + ")");
 }
开发者ID:JnS-Software-LLC,项目名称:npoi,代码行数:12,代码来源:ForkedEvaluator.cs

示例4: WriteOutAndReadBack

 public static IWorkbook WriteOutAndReadBack(IWorkbook wb)
 {
     IWorkbook result;
     try
     {
         using (MemoryStream baos = new MemoryStream(8192))
         {
             Stopwatch sw = new Stopwatch();
             sw.Start();
             wb.Write(baos);
             sw.Stop();
             Debug.WriteLine("XSSFWorkbook write time: " + sw.ElapsedMilliseconds + "ms");
             using (Stream is1 = new MemoryStream(baos.ToArray()))
             {
                 if (wb is HSSFWorkbook)
                 {
                     result = new HSSFWorkbook(is1);
                 }
                 else if (wb is XSSFWorkbook)
                 {
                     Stopwatch sw2 = new Stopwatch();
                     sw2.Start();
                     result = new XSSFWorkbook(is1);
                     sw2.Stop();
                     Debug.WriteLine("XSSFWorkbook parse time: " + sw2.ElapsedMilliseconds + "ms");
                 }
                 else
                 {
                     throw new RuntimeException("Unexpected workbook type ("
                             + wb.GetType().Name + ")");
                 }
             }
         }
     }
     catch (IOException e)
     {
         throw new RuntimeException(e);
     }
     return result;
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:40,代码来源:XSSFTestDataSamples.cs

示例5: CreateFormulaEvaluator

 /// <summary>
 /// Creates a specific FormulaEvaluator for the given workbook.
 /// </summary>
 public static IFormulaEvaluator CreateFormulaEvaluator(IWorkbook workbook)
 {
     if (typeof(HSSFWorkbook) == workbook.GetType())
     {
         return new HSSFFormulaEvaluator(workbook as HSSFWorkbook);
     }
     else
     {
         return new XSSFFormulaEvaluator(workbook as XSSFWorkbook);
     }
 }
开发者ID:jdineshk,项目名称:npoi,代码行数:14,代码来源:WorkbookFactory.cs


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