本文整理汇总了C#中NPOI.OpenXmlFormats.Spreadsheet.CT_Font.GetColorArray方法的典型用法代码示例。如果您正苦于以下问题:C# CT_Font.GetColorArray方法的具体用法?C# CT_Font.GetColorArray怎么用?C# CT_Font.GetColorArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPOI.OpenXmlFormats.Spreadsheet.CT_Font
的用法示例。
在下文中一共展示了CT_Font.GetColorArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetRunAttributes
/**
* Copy font attributes from CTFont bean into CTRPrElt bean
*/
private void SetRunAttributes(CT_Font ctFont, CT_RPrElt pr)
{
if (ctFont.SizeOfBArray() > 0) pr.AddNewB().val = (ctFont.GetBArray(0).val);
if (ctFont.sizeOfUArray() > 0) pr.AddNewU().val =(ctFont.GetUArray(0).val);
if (ctFont.sizeOfIArray() > 0) pr.AddNewI().val =(ctFont.GetIArray(0).val);
if (ctFont.sizeOfColorArray() > 0)
{
CT_Color c1 = ctFont.GetColorArray(0);
CT_Color c2 = pr.AddNewColor();
if (c1.IsSetAuto())
{
c2.auto = (c1.auto);
c2.autoSpecified = true;
}
if (c1.IsSetIndexed())
{
c2.indexed = (c1.indexed);
c2.indexedSpecified = true;
}
if (c1.IsSetRgb())
{
c2.SetRgb(c1.rgb);
c2.rgbSpecified = true;
}
if (c1.IsSetTheme())
{
c2.theme = (c1.theme);
c2.themeSpecified = true;
}
if (c1.IsSetTint())
{
c2.tint = (c1.tint);
c2.tintSpecified = true;
}
}
if (ctFont.sizeOfSzArray() > 0) pr.AddNewSz().val = (ctFont.GetSzArray(0).val);
if (ctFont.sizeOfNameArray() > 0) pr.AddNewRFont().val = (ctFont.name.val);
if (ctFont.sizeOfFamilyArray() > 0) pr.AddNewFamily().val =(ctFont.GetFamilyArray(0).val);
if (ctFont.sizeOfSchemeArray() > 0) pr.AddNewScheme().val = (ctFont.GetSchemeArray(0).val);
if (ctFont.sizeOfCharsetArray() > 0) pr.AddNewCharset().val = (ctFont.GetCharsetArray(0).val);
if (ctFont.sizeOfCondenseArray() > 0) pr.AddNewCondense().val = (ctFont.GetCondenseArray(0).val);
if (ctFont.sizeOfExtendArray() > 0) pr.AddNewExtend().val = (ctFont.GetExtendArray(0).val);
if (ctFont.sizeOfVertAlignArray() > 0) pr.AddNewVertAlign().val = (ctFont.GetVertAlignArray(0).val);
if (ctFont.sizeOfOutlineArray() > 0) pr.AddNewOutline().val =(ctFont.GetOutlineArray(0).val);
if (ctFont.sizeOfShadowArray() > 0) pr.AddNewShadow().val =(ctFont.GetShadowArray(0).val);
if (ctFont.sizeOfStrikeArray() > 0) pr.AddNewStrike().val = (ctFont.GetStrikeArray(0).val);
}
示例2: TestRgbColor
public void TestRgbColor()
{
CT_Font ctFont = new CT_Font();
CT_Color color = ctFont.AddNewColor();
//Integer.toHexString(0xFFFFFF).getBytes() = [102, 102, 102, 102, 102, 102]
color.SetRgb(Encoding.ASCII.GetBytes("ffffff"));
ctFont.SetColorArray(0, color);
XSSFFont xssfFont = new XSSFFont(ctFont);
Assert.AreEqual(ctFont.GetColorArray(0).GetRgb()[0], xssfFont.GetXSSFColor().GetRgb()[0]);
Assert.AreEqual(ctFont.GetColorArray(0).GetRgb()[1], xssfFont.GetXSSFColor().GetRgb()[1]);
Assert.AreEqual(ctFont.GetColorArray(0).GetRgb()[2], xssfFont.GetXSSFColor().GetRgb()[2]);
Assert.AreEqual(ctFont.GetColorArray(0).GetRgb()[3], xssfFont.GetXSSFColor().GetRgb()[3]);
//Integer.toHexString(0xF1F1F1).getBytes() = [102, 49, 102, 49, 102, 49]
color.SetRgb(Encoding.ASCII.GetBytes("f1f1f1"));
XSSFColor newColor = new XSSFColor(color);
xssfFont.SetColor(newColor);
Assert.AreEqual(ctFont.GetColorArray(0).GetRgb()[2], newColor.GetRgb()[2]);
}
示例3: TestThemeColor
public void TestThemeColor()
{
CT_Font ctFont = new CT_Font();
CT_Color color = ctFont.AddNewColor();
color.theme = (1);
color.themeSpecified = true;
ctFont.SetColorArray(0, color);
XSSFFont xssfFont = new XSSFFont(ctFont);
Assert.AreEqual((short)ctFont.GetColorArray(0).theme, xssfFont.GetThemeColor());
xssfFont.SetThemeColor(IndexedColors.Red.Index);
Assert.AreEqual((uint)IndexedColors.Red.Index, ctFont.GetColorArray(0).theme);
}
示例4: TestColor
public void TestColor()
{
CT_Font ctFont = new CT_Font();
CT_Color color = ctFont.AddNewColor();
color.indexed = (uint)(XSSFFont.DEFAULT_FONT_COLOR);
ctFont.SetColorArray(0, color);
XSSFFont xssfFont = new XSSFFont(ctFont);
Assert.AreEqual(IndexedColors.Black.Index, xssfFont.Color);
xssfFont.Color = IndexedColors.Red.Index;
Assert.AreEqual((uint)IndexedColors.Red.Index, ctFont.GetColorArray(0).indexed);
}