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


C# IWorkbook.GetFontAt方法代码示例

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


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

示例1: CopyCellStyle

 /// <summary>
 /// Copy c1 into c2
 /// </summary>
 public static void CopyCellStyle(IWorkbook wb, ICellStyle c1, ICellStyle c2)
 {
     c2.Alignment = c1.Alignment;
       c2.BorderBottom = c1.BorderBottom;
       c2.BorderLeft = c1.BorderLeft;
       c2.BorderRight = c1.BorderRight;
       c2.BorderTop = c1.BorderTop;
       c2.BottomBorderColor = c1.BottomBorderColor;
       c2.DataFormat = c1.DataFormat;
       c2.FillBackgroundColor = c1.FillBackgroundColor;
       c2.FillForegroundColor = c1.FillForegroundColor;
       c2.FillPattern = c1.FillPattern;
       c2.SetFont(wb.GetFontAt(c1.FontIndex));
       // HIDDEN ?
       c2.Indention = c1.Indention;
       c2.LeftBorderColor = c1.LeftBorderColor;
       // LOCKED ?
       c2.RightBorderColor = c1.RightBorderColor;
       c2.Rotation = c1.Rotation;
       c2.TopBorderColor = c1.TopBorderColor;
       c2.VerticalAlignment = c1.VerticalAlignment;
       c2.WrapText = c1.WrapText;
 }
开发者ID:Stef569,项目名称:npoi-wrapper,代码行数:26,代码来源:CellStyleCache.cs

示例2: SetFormatProperties

 /**
  * Sets the format properties of the given style based on the given map.
  *
  * @param style cell style
  * @param workbook parent workbook
  * @param properties map of format properties (String -> Object)
  * @see #getFormatProperties(CellStyle)
  */
 private static void SetFormatProperties(ICellStyle style, IWorkbook workbook, Dictionary<String, Object> properties)
 {
     style.Alignment=(HorizontalAlignment)(GetShort(properties, ALIGNMENT));
     style.BorderBottom=(BorderStyle)(GetShort(properties, BORDER_BOTTOM));
     style.BorderLeft=(BorderStyle)(GetShort(properties, BORDER_LEFT));
     style.BorderRight=(BorderStyle)(GetShort(properties, BORDER_RIGHT));
     style.BorderTop=(BorderStyle)(GetShort(properties, BORDER_TOP));
     style.BottomBorderColor=(GetShort(properties, BOTTOM_BORDER_COLOR));
     style.DataFormat=(GetShort(properties, DATA_FORMAT));
     style.FillBackgroundColor=(GetShort(properties, FILL_BACKGROUND_COLOR));
     style.FillForegroundColor=(GetShort(properties, FILL_FOREGROUND_COLOR));
     style.FillPattern=(FillPatternType)(GetShort(properties, FILL_PATTERN));
     style.SetFont(workbook.GetFontAt(GetShort(properties, FONT)));
     style.IsHidden=(GetBoolean(properties, HIDDEN));
     style.Indention=(GetShort(properties, INDENTION));
     style.LeftBorderColor=(GetShort(properties, LEFT_BORDER_COLOR));
     style.IsLocked=(GetBoolean(properties, LOCKED));
     style.RightBorderColor=(GetShort(properties, RIGHT_BORDER_COLOR));
     style.Rotation=(GetShort(properties, ROTATION));
     style.TopBorderColor=(GetShort(properties, TOP_BORDER_COLOR));
     style.VerticalAlignment=(VerticalAlignment)(GetShort(properties, VERTICAL_ALIGNMENT));
     style.WrapText=(GetBoolean(properties, WRAP_TEXT));
 }
开发者ID:missxiaohuang,项目名称:Weekly,代码行数:31,代码来源:CellUtil.cs

示例3: FixFonts

 internal static void FixFonts(IWorkbook workbook)
 {
     //if (!JvmBugs.HasLineBreakMeasurerBug()) return;
     for (int i = workbook.NumberOfFonts - 1; i >= 0; i--)
     {
         IFont f = workbook.GetFontAt((short)0);
         if ("Calibri".Equals(f.FontName))
         {
             f.FontName = (/*setter*/"Lucida Sans");
         }
         else if ("Cambria".Equals(f.FontName))
         {
             f.FontName = (/*setter*/"Lucida Bright");
         }
     }
 }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:16,代码来源:BaseTestSheetAutosizeColumn.cs

示例4: SaveAndReloadReport

        private void SaveAndReloadReport(IWorkbook wb, FileInfo outFile)
        {
            // run some method on the font to verify if it is "disconnected" already
            //for(short i = 0;i < 256;i++)
            {
                IFont font = wb.GetFontAt((short)0);
                if (font is XSSFFont)
                {
                    XSSFFont xfont = (XSSFFont)wb.GetFontAt((short)0);
                    CT_Font ctFont = (CT_Font)xfont.GetCTFont();
                    Assert.AreEqual(0, ctFont.sizeOfBArray());
                }
            }

            FileStream fileOutStream = new FileStream(outFile.FullName, FileMode.Truncate, FileAccess.ReadWrite);
            wb.Write(fileOutStream);
            fileOutStream.Close();
            //Console.WriteLine("File \""+outFile.GetName()+"\" has been saved successfully");

            Stream is1 = new FileStream(outFile.FullName, FileMode.Truncate, FileAccess.ReadWrite);
            try
            {
                IWorkbook newWB;
                if (wb is XSSFWorkbook)
                {
                    newWB = new XSSFWorkbook(is1);
                }
                else if (wb is HSSFWorkbook)
                {
                    newWB = new HSSFWorkbook(is1);
                    //} else if(wb is SXSSFWorkbook) {
                    //    newWB = new SXSSFWorkbook(new XSSFWorkbook(is1));
                }
                else
                {
                    throw new InvalidOperationException("Unknown workbook: " + wb);
                }
                Assert.IsNotNull(newWB.GetSheet("test"));
            }
            finally
            {
                is1.Close();
            }
        }
开发者ID:mdjasim,项目名称:npoi,代码行数:44,代码来源:TestUnfixedBugs.cs

示例5: RegisterTitleStyle

 public virtual void RegisterTitleStyle(IWorkbook workbook, ICellStyle cellStyle)
 {
     cellStyle.SetBorder();
     cellStyle.SetBackgroundColor(HSSFColor.Red.Index);
     cellStyle.SetFont(workbook.GetFontAt(1));
 }
开发者ID:holer-h,项目名称:yjinglee.office,代码行数:6,代码来源:DefaultStyle.cs


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