public void TestBoldweight() { CT_Font ctFont = new CT_Font(); CT_BooleanProperty bool1 = ctFont.AddNewB(); bool1.val = (false); ctFont.SetBArray(0, bool1); XSSFFont xssfFont = new XSSFFont(ctFont); Assert.AreEqual(false, xssfFont.IsBold); xssfFont.IsBold = (true); Assert.AreEqual(ctFont.b.Count, 1); Assert.AreEqual(true, ctFont.GetBArray(0).val); }
public void ParseTest() { string fontName = "Tahoma"; CT_Font expected = new CT_Font(); var name = expected.AddNewName(); name.val = fontName; var b = expected.AddNewB(); b.val = true; string firstXml = CT_Font.GetString(expected); CT_Font actual = CT_Font.Parse(firstXml); string secondXml = CT_Font.GetString(actual); Assert.AreEqual(firstXml, secondXml); Assert.AreEqual(expected.name.val, actual.name.val); Assert.AreEqual(fontName, actual.name.val); Assert.AreEqual(expected.nameSpecified, actual.nameSpecified); Assert.AreEqual(expected.b.val, actual.b.val); Assert.AreEqual(true, actual.b.val); Assert.AreEqual(expected.bSpecified, actual.bSpecified); Assert.AreEqual(expected.iSpecified, actual.iSpecified); Assert.AreEqual(false, actual.iSpecified); }
public CT_Font Clone() { CT_Font ctFont = new CT_Font(); if (this.name != null) { CT_FontName newName = ctFont.AddNewName(); newName.val = this.name.val; } if (this.charset != null) { foreach (CT_IntProperty ctCharset in this.charset) { CT_IntProperty newCharset = ctFont.AddNewCharset(); newCharset.val = ctCharset.val; } } if (this.family != null) { foreach (CT_IntProperty ctFamily in this.family) { CT_IntProperty newFamily = ctFont.AddNewFamily(); newFamily.val = ctFamily.val; } } if (this.b != null) { foreach (CT_BooleanProperty ctB in this.b) { CT_BooleanProperty newB = ctFont.AddNewB(); newB.val = ctB.val; } } if (this.i != null) { foreach (CT_BooleanProperty ctI in this.i) { CT_BooleanProperty newI = ctFont.AddNewB(); newI.val = ctI.val; } } if (this.strike != null) { foreach (CT_BooleanProperty ctStrike in this.strike) { CT_BooleanProperty newstrike = ctFont.AddNewStrike(); newstrike.val = ctStrike.val; } } if (this.outline != null) { ctFont.outline = new CT_BooleanProperty(); ctFont.outline.val = this.outline.val; } if (this.shadow != null) { ctFont.shadow = new CT_BooleanProperty(); ctFont.shadow.val = this.shadow.val; } if (this.condense != null) { ctFont.condense = new CT_BooleanProperty(); ctFont.condense.val = this.condense.val; } if (this.extend != null) { ctFont.extend = new CT_BooleanProperty(); ctFont.extend.val = this.extend.val; } if (this.color != null) { foreach (CT_Color ctColor in this.color) { CT_Color newColor = ctFont.AddNewColor(); newColor.theme = ctColor.theme; } } if (this.sz != null) { foreach (CT_FontSize ctSz in this.sz) { CT_FontSize newSz = ctFont.AddNewSz(); newSz.val = ctSz.val; } } if (this.u != null) { foreach (CT_UnderlineProperty ctU in this.u) { CT_UnderlineProperty newU = ctFont.AddNewU(); newU.val = ctU.val; } } if (this.vertAlign != null) { foreach (CT_VerticalAlignFontProperty ctVertAlign in this.vertAlign) { CT_VerticalAlignFontProperty newVertAlign = ctFont.AddNewVertAlign(); newVertAlign.val = ctVertAlign.val; } } if (this.scheme != null) { foreach (CT_FontScheme ctScheme in this.scheme) { CT_FontScheme newScheme = ctFont.AddNewScheme(); newScheme.val = ctScheme.val; } } return(ctFont); }
/** * * CTRPrElt --> CTFont adapter */ protected static CT_Font ToCTFont(CT_RPrElt pr) { CT_Font ctFont = new CT_Font(); if (pr.sizeOfBArray() > 0) ctFont.AddNewB().val = (pr.GetBArray(0).val); if (pr.sizeOfUArray() > 0) ctFont.AddNewU().val = (pr.GetUArray(0).val); if (pr.sizeOfIArray() > 0) ctFont.AddNewI().val = (pr.GetIArray(0).val); if (pr.sizeOfColorArray() > 0) { CT_Color c1 = pr.GetColorArray(0); CT_Color c2 = ctFont.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.GetRgb()); c2.rgbSpecified = true; } if (c1.IsSetTheme()) { c2.theme = (c1.theme); c2.themeSpecified = true; } if (c1.IsSetTint()) { c2.tint = (c1.tint); c2.tintSpecified = true; } } if (pr.sizeOfSzArray() > 0) ctFont.AddNewSz().val = (pr.GetSzArray(0).val); if (pr.sizeOfRFontArray() > 0) ctFont.AddNewName().val = (pr.GetRFontArray(0).val); if (pr.sizeOfFamilyArray() > 0) ctFont.AddNewFamily().val = (pr.GetFamilyArray(0).val); if (pr.sizeOfSchemeArray() > 0) ctFont.AddNewScheme().val = (pr.GetSchemeArray(0).val); if (pr.sizeOfCharsetArray() > 0) ctFont.AddNewCharset().val = (pr.GetCharsetArray(0).val); if (pr.sizeOfCondenseArray() > 0) ctFont.AddNewCondense().val = (pr.GetCondenseArray(0).val); if (pr.sizeOfExtendArray() > 0) ctFont.AddNewExtend().val = (pr.GetExtendArray(0).val); if (pr.sizeOfVertAlignArray() > 0) ctFont.AddNewVertAlign().val = (pr.GetVertAlignArray(0).val); if (pr.sizeOfOutlineArray() > 0) ctFont.AddNewOutline().val = (pr.GetOutlineArray(0).val); if (pr.sizeOfShadowArray() > 0) ctFont.AddNewShadow().val = (pr.GetShadowArray(0).val); if (pr.sizeOfStrikeArray() > 0) ctFont.AddNewStrike().val = (pr.GetStrikeArray(0).val); return ctFont; }
public CT_Font Clone() { CT_Font ctFont = new CT_Font(); if (this.name.Count != 0) { CT_FontName newName = ctFont.AddNewName(); newName.val = this.GetNameArray(0).val; } if (this.charset.Count != 0) { CT_IntProperty newCharset = ctFont.AddNewCharset(); newCharset.val = this.GetCharsetArray(0).val; } if (this.family.Count != 0) { CT_IntProperty newFamily = ctFont.AddNewFamily(); newFamily.val = this.GetFamilyArray(0).val; } if (this.b.Count != 0) { CT_BooleanProperty newB = ctFont.AddNewB(); newB.val = this.GetBArray(0).val; } if (this.i.Count != 0) { CT_BooleanProperty newI = ctFont.AddNewI(); newI.val = this.GetIArray(0).val; } if (this.strike.Count != 0) { CT_BooleanProperty newstrike = ctFont.AddNewStrike(); newstrike.val = this.GetStrikeArray(0).val; } if (this.outline != null) { ctFont.outline = new CT_BooleanProperty(); ctFont.outline.val = this.outline.val; } if (this.shadow != null) { ctFont.shadow = new CT_BooleanProperty(); ctFont.shadow.val = this.shadow.val; } if (this.condense != null) { ctFont.condense = new CT_BooleanProperty(); ctFont.condense.val = this.condense.val; } if (this.extend != null) { ctFont.extend = new CT_BooleanProperty(); ctFont.extend.val = this.extend.val; } if (this.color.Count != 0) { CT_Color newColor = ctFont.AddNewColor(); newColor.theme = this.GetColorArray(0).theme; } if (this.sz.Count != 0) { CT_FontSize newSz = ctFont.AddNewSz(); newSz.val = this.GetSzArray(0).val; } if (this.u.Count != 0) { CT_UnderlineProperty newU = ctFont.AddNewU(); newU.val = this.GetUArray(0).val; } if (this.vertAlign.Count != 0) { CT_VerticalAlignFontProperty newVertAlign = ctFont.AddNewVertAlign(); newVertAlign.val = this.GetVertAlignArray(0).val; } if (this.scheme.Count != 0) { CT_FontScheme newFs = ctFont.AddNewScheme(); newFs.val = this.GetSchemeArray(0).val; } return ctFont; }
public CT_Font Clone() { CT_Font ctFont = new CT_Font(); if (this.name!=null) { CT_FontName newName = ctFont.AddNewName(); newName.val = this.name.val; } if (this.charset!=null) { foreach (CT_IntProperty ctCharset in this.charset) { CT_IntProperty newCharset = ctFont.AddNewCharset(); newCharset.val = ctCharset.val; } } if (this.family!=null) { foreach (CT_IntProperty ctFamily in this.family) { CT_IntProperty newFamily = ctFont.AddNewFamily(); newFamily.val = ctFamily.val; } } if (this.b != null) { foreach (CT_BooleanProperty ctB in this.b) { CT_BooleanProperty newB = ctFont.AddNewB(); newB.val = ctB.val; } } if (this.i != null) { foreach (CT_BooleanProperty ctI in this.i) { CT_BooleanProperty newI = ctFont.AddNewB(); newI.val = ctI.val; } } if (this.strike != null) { foreach (CT_BooleanProperty ctStrike in this.strike) { CT_BooleanProperty newstrike = ctFont.AddNewStrike(); newstrike.val = ctStrike.val; } } if (this.outline != null) { ctFont.outline = new CT_BooleanProperty(); ctFont.outline.val = this.outline.val; } if (this.shadow != null) { ctFont.shadow = new CT_BooleanProperty(); ctFont.shadow.val = this.shadow.val; } if (this.condense != null) { ctFont.condense = new CT_BooleanProperty(); ctFont.condense.val = this.condense.val; } if (this.extend != null) { ctFont.extend = new CT_BooleanProperty(); ctFont.extend.val = this.extend.val; } if (this.color != null) { foreach (CT_Color ctColor in this.color) { CT_Color newColor = ctFont.AddNewColor(); newColor.theme = ctColor.theme; } } if (this.sz != null) { foreach (CT_FontSize ctSz in this.sz) { CT_FontSize newSz = ctFont.AddNewSz(); newSz.val = ctSz.val; } } if (this.u != null) { foreach (CT_UnderlineProperty ctU in this.u) { CT_UnderlineProperty newU = ctFont.AddNewU(); newU.val = ctU.val; } } if (this.vertAlign != null) { foreach (CT_VerticalAlignFontProperty ctVertAlign in this.vertAlign) { CT_VerticalAlignFontProperty newVertAlign = ctFont.AddNewVertAlign(); newVertAlign.val = ctVertAlign.val; } } if (this.scheme != null) { foreach (CT_FontScheme ctScheme in this.scheme) { CT_FontScheme newScheme = ctFont.AddNewScheme(); newScheme.val = ctScheme.val; } } return ctFont; }
public CT_Font Clone() { CT_Font ctFont = new CT_Font(); if (this.name != null) { CT_FontName newName = ctFont.AddNewName(); newName.val = this.name.val; } if (this.charset != null) { foreach (CT_IntProperty ctCharset in this.charset) { CT_IntProperty newCharset = ctFont.AddNewCharset(); newCharset.val = ctCharset.val; } } if (this.family != null) { foreach (CT_IntProperty ctFamily in this.family) { CT_IntProperty newFamily = ctFont.AddNewFamily(); newFamily.val = ctFamily.val; } } if (this.b != null) { foreach (CT_BooleanProperty ctB in this.b) { CT_BooleanProperty newB = ctFont.AddNewB(); newB.val = ctB.val; } } if (this.i != null) { foreach (CT_BooleanProperty ctI in this.i) { CT_BooleanProperty newI = ctFont.AddNewI(); newI.val = ctI.val; } } if (this.strike != null) { foreach (CT_BooleanProperty ctStrike in this.strike) { CT_BooleanProperty newstrike = ctFont.AddNewStrike(); newstrike.val = ctStrike.val; } } if (this.outline != null) { ctFont.outline = new CT_BooleanProperty(); ctFont.outline.val = this.outline.val; } if (this.shadow != null) { ctFont.shadow = new CT_BooleanProperty(); ctFont.shadow.val = this.shadow.val; } if (this.condense != null) { ctFont.condense = new CT_BooleanProperty(); ctFont.condense.val = this.condense.val; } if (this.extend != null) { ctFont.extend = new CT_BooleanProperty(); ctFont.extend.val = this.extend.val; } if (this.color != null) { foreach (CT_Color ctColor in this.color) { CT_Color newColor = ctFont.AddNewColor(); newColor.theme = ctColor.theme; //Forces themeSpecified to true even if a theme wasn't specified. newColor.themeSpecified = ctColor.themeSpecified; newColor.rgb = ctColor.rgb; newColor.rgbSpecified = ctColor.rgbSpecified; newColor.tint = ctColor.tint; newColor.tintSpecified = ctColor.tintSpecified; newColor.auto = ctColor.auto; newColor.autoSpecified = ctColor.autoSpecified; //Does not copy indexed color field because we don't support indexed colors for XSSF. //If copying indexed colors between two documents you need to account for the color palettes //potentially being different between two documents. (MSSQL Reporting Services did this in HSSF) } } if (this.sz != null) { foreach (CT_FontSize ctSz in this.sz) { CT_FontSize newSz = ctFont.AddNewSz(); newSz.val = ctSz.val; } } if (this.u != null) { foreach (CT_UnderlineProperty ctU in this.u) { CT_UnderlineProperty newU = ctFont.AddNewU(); newU.val = ctU.val; } } if (this.vertAlign != null) { foreach (CT_VerticalAlignFontProperty ctVertAlign in this.vertAlign) { CT_VerticalAlignFontProperty newVertAlign = ctFont.AddNewVertAlign(); newVertAlign.val = ctVertAlign.val; } } if (this.scheme != null) { foreach (CT_FontScheme ctScheme in this.scheme) { CT_FontScheme newScheme = ctFont.AddNewScheme(); newScheme.val = ctScheme.val; } } return(ctFont); }