public CT_TextCharacterProperties() { this.extLstField = new CT_OfficeArtExtensionList(); this.hlinkMouseOverField = new CT_Hyperlink(); this.hlinkClickField = new CT_Hyperlink(); this.symField = new CT_TextFont(); this.csField = new CT_TextFont(); this.eaField = new CT_TextFont(); this.latinField = new CT_TextFont(); this.uFillField = new CT_TextUnderlineFillGroupWrapper(); this.uFillTxField = new CT_TextUnderlineFillFollowText(); this.uLnField = new CT_LineProperties(); this.uLnTxField = new CT_TextUnderlineLineFollowText(); this.highlightField = new CT_Color(); this.effectDagField = new CT_EffectContainer(); this.effectLstField = new CT_EffectList(); this.grpFillField = new CT_GroupFillProperties(); this.pattFillField = new CT_PatternFillProperties(); this.blipFillField = new CT_BlipFillProperties(); this.gradFillField = new CT_GradientFillProperties(); this.solidFillField = new CT_SolidColorFillProperties(); this.noFillField = new CT_NoFillProperties(); this.lnField = new CT_LineProperties(); this.dirtyField = true; this.errField = false; this.smtCleanField = true; this.smtIdField = ((uint)(0)); }
public void SetFontColor(Color color) { CT_TextCharacterProperties rPr = GetRPr(); CT_SolidColorFillProperties fill = rPr.IsSetSolidFill() ? rPr.solidFill : rPr.AddNewSolidFill(); CT_SRgbColor clr = fill.IsSetSrgbClr() ? fill.srgbClr : fill.AddNewSrgbClr(); clr.val = (new byte[] { color.R, color.G, color.B }); if (fill.IsSetHslClr()) { fill.UnsetHslClr(); } if (fill.IsSetPrstClr()) { fill.UnsetPrstClr(); } if (fill.IsSetSchemeClr()) { fill.UnsetSchemeClr(); } if (fill.IsSetScrgbClr()) { fill.UnsetScrgbClr(); } if (fill.IsSetSysClr()) { fill.UnsetSysClr(); } }
public CT_TableCellProperties() { this.extLstField = new CT_OfficeArtExtensionList(); this.grpFillField = new CT_GroupFillProperties(); this.pattFillField = new CT_PatternFillProperties(); this.blipFillField = new CT_BlipFillProperties(); this.gradFillField = new CT_GradientFillProperties(); this.solidFillField = new CT_SolidColorFillProperties(); this.noFillField = new CT_NoFillProperties(); this.cell3DField = new CT_Cell3D(); this.lnBlToTrField = new CT_LineProperties(); this.lnTlToBrField = new CT_LineProperties(); this.lnBField = new CT_LineProperties(); this.lnTField = new CT_LineProperties(); this.lnRField = new CT_LineProperties(); this.lnLField = new CT_LineProperties(); this.marLField = 91440; this.marRField = 91440; this.marTField = 45720; this.marBField = 45720; this.vertField = ST_TextVerticalType.horz; this.anchorField = ST_TextAnchoringType.t; this.anchorCtrField = false; this.horzOverflowField = ST_TextHorzOverflowType.clip; }
/** * * org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRPrElt to * org.openxmlformats.schemas.drawingml.x2006.main.CTFont adapter */ private static void ApplyAttributes(CT_RPrElt pr, CT_TextCharacterProperties rPr) { if (pr.sizeOfBArray() > 0) { rPr.b = (pr.GetBArray(0).val); } if (pr.sizeOfUArray() > 0) { ST_UnderlineValues u1 = pr.GetUArray(0).val; if (u1 == ST_UnderlineValues.single) { rPr.u = (ST_TextUnderlineType.sng); } else if (u1 == ST_UnderlineValues.@double) { rPr.u = (ST_TextUnderlineType.dbl); } else if (u1 == ST_UnderlineValues.none) { rPr.u = (ST_TextUnderlineType.none); } } if (pr.sizeOfIArray() > 0) { rPr.i = (pr.GetIArray(0).val); } if (pr.sizeOfFamilyArray() > 0) { CT_TextFont rFont = rPr.AddNewLatin(); rFont.typeface = (pr.GetRFontArray(0).val); } if (pr.sizeOfSzArray() > 0) { int sz = (int)(pr.GetSzArray(0).val * 100); rPr.sz = (sz); } if (pr.sizeOfColorArray() > 0) { CT_SolidColorFillProperties fill = rPr.IsSetSolidFill() ? rPr.solidFill : rPr.AddNewSolidFill(); NPOI.OpenXmlFormats.Spreadsheet.CT_Color xlsColor = pr.GetColorArray(0); if (xlsColor.IsSetRgb()) { CT_SRgbColor clr = fill.IsSetSrgbClr() ? fill.srgbClr : fill.AddNewSrgbClr(); clr.val = (xlsColor.rgb); } else if (xlsColor.IsSetIndexed()) { HSSFColor indexed = HSSFColor.GetIndexHash()[(int)xlsColor.indexed] as HSSFColor; if (indexed != null) { byte[] rgb = indexed.RGB; CT_SRgbColor clr = fill.IsSetSrgbClr() ? fill.srgbClr : fill.AddNewSrgbClr(); clr.val = (rgb); } } } }
internal void AddToChart(CT_LineChart ctLineChart) { CT_LineSer ctLineSer = ctLineChart.AddNewSer(); CT_Grouping ctGrouping = ctLineChart.AddNewGrouping(); ctGrouping.val = ST_Grouping.standard; ctLineSer.AddNewIdx().val = (uint)id; ctLineSer.AddNewOrder().val = (uint)order; // No marker symbol on the chart line. ctLineSer.AddNewMarker().AddNewSymbol().val = ST_MarkerStyle.none; CT_AxDataSource catDS = ctLineSer.AddNewCat(); XSSFChartUtil.BuildAxDataSource(catDS, categories); CT_NumDataSource valueDS = ctLineSer.AddNewVal(); XSSFChartUtil.BuildNumDataSource(valueDS, values); if (IsTitleSet) { ctLineSer.tx = GetCTSerTx(); } if (fillColor != null) { ctLineSer.spPr = new OpenXmlFormats.Dml.Chart.CT_ShapeProperties(); CT_LineProperties ctLineProperties = ctLineSer.spPr.AddNewLn(); CT_SolidColorFillProperties ctSolidColorFillProperties = ctLineProperties.AddNewSolidFill(); CT_SRgbColor ctSRgbColor = ctSolidColorFillProperties.AddNewSrgbClr(); ctSRgbColor.val = fillColor; } }
/** * Sets the color used to fill this shape using the solid fill pattern. */ public void SetFillColor(int red, int green, int blue) { CT_ShapeProperties props = GetShapeProperties(); CT_SolidColorFillProperties fill = props.IsSetSolidFill() ? props.solidFill : props.AddNewSolidFill(); CT_SRgbColor rgb = new CT_SRgbColor(); rgb.val = (new byte[] { (byte)red, (byte)green, (byte)blue }); fill.srgbClr = (rgb); }
/** * The color applied to the lines of this shape. */ public void SetLineStyleColor(int red, int green, int blue) { CT_ShapeProperties props = GetShapeProperties(); CT_LineProperties ln = props.IsSetLn() ? props.ln : props.AddNewLn(); CT_SolidColorFillProperties fill = ln.IsSetSolidFill() ? ln.solidFill : ln.AddNewSolidFill(); CT_SRgbColor rgb = new CT_SRgbColor(); rgb.val = (new byte[] { (byte)red, (byte)green, (byte)blue }); fill.srgbClr = (rgb); }
/** * The color applied to the lines of this shape. */ public virtual void SetLineStyleColor(int red, int green, int blue) { Npoi.Core.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperties props = GetShapeProperties(); CT_LineProperties ln = props.IsSetLn() ? props.ln : props.AddNewLn(); CT_SolidColorFillProperties fill = ln.IsSetSolidFill() ? ln.solidFill : ln.AddNewSolidFill(); CT_SRgbColor rgb = new CT_SRgbColor(); rgb.val = (new byte[] { (byte)red, (byte)green, (byte)blue }); fill.srgbClr = (rgb); }
public CT_BackgroundFormatting() { this.effectDagField = new CT_EffectContainer(); this.effectLstField = new CT_EffectList(); this.grpFillField = new CT_GroupFillProperties(); this.pattFillField = new CT_PatternFillProperties(); this.blipFillField = new CT_BlipFillProperties(); this.gradFillField = new CT_GradientFillProperties(); this.solidFillField = new CT_SolidColorFillProperties(); this.noFillField = new CT_NoFillProperties(); }
public CT_GroupShapeProperties() { this.extLstField = new CT_OfficeArtExtensionList(); this.scene3dField = new CT_Scene3D(); this.effectDagField = new CT_EffectContainer(); this.effectLstField = new CT_EffectList(); this.grpFillField = new CT_GroupFillProperties(); this.pattFillField = new CT_PatternFillProperties(); this.blipFillField = new CT_BlipFillProperties(); this.gradFillField = new CT_GradientFillProperties(); this.solidFillField = new CT_SolidColorFillProperties(); this.noFillField = new CT_NoFillProperties(); //this.xfrmField = new CT_GroupTransform2D(); }
/** * Prototype with the default structure of a new auto-shape. */ protected internal static CT_Shape Prototype() { // in poi, method XmlObject set(XmlObject srcObj) will create a copy of XmlObject // so this prototype object would be newly set to shape object // but in .net, the prototype object will be modified and keep its contents, would // affect next usage. so comment the following code, and create a new prototype object // for every calling of Prototype(). //if (prototype == null) { CT_Shape shape = new CT_Shape(); CT_ShapeNonVisual nv = shape.AddNewNvSpPr(); NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps nvp = nv.AddNewCNvPr(); nvp.id = (/*setter*/ 1); nvp.name = (/*setter*/ "Shape 1"); nv.AddNewCNvSpPr(); NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperties sp = shape.AddNewSpPr(); CT_Transform2D t2d = sp.AddNewXfrm(); CT_PositiveSize2D p1 = t2d.AddNewExt(); p1.cx = (/*setter*/ 0); p1.cy = (/*setter*/ 0); CT_Point2D p2 = t2d.AddNewOff(); p2.x = (/*setter*/ 0); p2.y = (/*setter*/ 0); CT_PresetGeometry2D geom = sp.AddNewPrstGeom(); geom.prst = (/*setter*/ ST_ShapeType.rect); geom.AddNewAvLst(); NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_TextBody body = shape.AddNewTxBody(); CT_TextBodyProperties bodypr = body.AddNewBodyPr(); bodypr.anchor = (/*setter*/ ST_TextAnchoringType.t); bodypr.rtlCol = (/*setter*/ false); CT_TextParagraph p = body.AddNewP(); p.AddNewPPr().algn = (/*setter*/ ST_TextAlignType.l); CT_TextCharacterProperties endPr = p.AddNewEndParaRPr(); endPr.lang = (/*setter*/ "en-US"); endPr.sz = (/*setter*/ 1100); CT_SolidColorFillProperties scfpr = endPr.AddNewSolidFill(); scfpr.AddNewSrgbClr().val = (/*setter*/ new byte[] { 0, 0, 0 }); body.AddNewLstStyle(); prototype = shape; } return(prototype); }
public Color GetFontColor() { CT_TextCharacterProperties rPr = GetRPr(); if (rPr.IsSetSolidFill()) { CT_SolidColorFillProperties fill = rPr.solidFill; if (fill.IsSetSrgbClr()) { CT_SRgbColor clr = fill.srgbClr; byte[] rgb = clr.val; return(Color.FromArgb(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2])); } } return(Color.FromArgb(0, 0, 0)); }
public CT_TableProperties() { this.extLstField = new CT_OfficeArtExtensionList(); this.effectDagField = new CT_EffectContainer(); this.effectLstField = new CT_EffectList(); this.grpFillField = new CT_GroupFillProperties(); this.pattFillField = new CT_PatternFillProperties(); this.blipFillField = new CT_BlipFillProperties(); this.gradFillField = new CT_GradientFillProperties(); this.solidFillField = new CT_SolidColorFillProperties(); this.noFillField = new CT_NoFillProperties(); this.rtlField = false; this.firstRowField = false; this.firstColField = false; this.lastRowField = false; this.lastColField = false; this.bandRowField = false; this.bandColField = false; }
/** * Prototype with the default structure of a new auto-shape. */ protected internal static CT_Shape GetPrototype() { if (prototype == null) { CT_Shape shape = new CT_Shape(); CT_ShapeNonVisual nv = shape.AddNewNvSpPr(); NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps nvp = nv.AddNewCNvPr(); nvp.id = (/*setter*/ 1); nvp.name = (/*setter*/ "Shape 1"); nv.AddNewCNvSpPr(); NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperties sp = shape.AddNewSpPr(); NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Transform2D t2d = sp.AddNewXfrm(); CT_PositiveSize2D p1 = t2d.AddNewExt(); p1.cx = (/*setter*/ 0); p1.cy = (/*setter*/ 0); CT_Point2D p2 = t2d.AddNewOff(); p2.x = (/*setter*/ 0); p2.y = (/*setter*/ 0); CT_PresetGeometry2D geom = sp.AddNewPrstGeom(); geom.prst = (/*setter*/ ST_ShapeType.rect); geom.AddNewAvLst(); NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_TextBody body = shape.AddNewTxBody(); CT_TextBodyProperties bodypr = body.AddNewBodyPr(); bodypr.anchor = (/*setter*/ ST_TextAnchoringType.t); bodypr.rtlCol = (/*setter*/ false); CT_TextParagraph p = body.AddNewP(); p.AddNewPPr().algn = (/*setter*/ ST_TextAlignType.l); CT_TextCharacterProperties endPr = p.AddNewEndParaRPr(); endPr.lang = (/*setter*/ "en-US"); endPr.sz = (/*setter*/ 1100); CT_SolidColorFillProperties scfpr = endPr.AddNewSolidFill(); scfpr.AddNewSrgbClr().val = (/*setter*/ new byte[] { 0, 0, 0 }); body.AddNewLstStyle(); prototype = shape; } return(prototype); }
public static CT_TextUnderlineFillGroupWrapper Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_TextUnderlineFillGroupWrapper ctObj = new CT_TextUnderlineFillGroupWrapper(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "noFill") { ctObj.noFill = new CT_NoFillProperties(); } else if (childNode.LocalName == "solidFill") { ctObj.solidFill = CT_SolidColorFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "gradFill") { ctObj.gradFill = CT_GradientFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "blipFill") { ctObj.blipFill = CT_BlipFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "pattFill") { ctObj.pattFill = CT_PatternFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "grpFill") { ctObj.grpFill = new CT_GroupFillProperties(); } } return(ctObj); }
internal void AddToChart(CT_BarChart ctBarChart) { CT_BarSer ctBarSer = ctBarChart.AddNewSer(); CT_BarGrouping ctGrouping = ctBarChart.AddNewGrouping(); ctGrouping.val = ST_BarGrouping.clustered; ctBarSer.AddNewIdx().val = (uint)id; ctBarSer.AddNewOrder().val = (uint)order; CT_Boolean ctNoInvertIfNegative = new CT_Boolean(); ctNoInvertIfNegative.val = 0; ctBarSer.invertIfNegative = ctNoInvertIfNegative; CT_BarDir ctBarDir = ctBarChart.AddNewBarDir(); ctBarDir.val = ST_BarDir.col; CT_AxDataSource catDS = ctBarSer.AddNewCat(); XSSFChartUtil.BuildAxDataSource(catDS, categories); CT_NumDataSource valueDS = ctBarSer.AddNewVal(); XSSFChartUtil.BuildNumDataSource(valueDS, values); if (IsTitleSet) { ctBarSer.tx = GetCTSerTx(); } if (fillColor != null) { ctBarSer.spPr = new OpenXmlFormats.Dml.Chart.CT_ShapeProperties(); CT_SolidColorFillProperties ctSolidColorFillProperties = ctBarSer.spPr.AddNewSolidFill(); CT_SRgbColor ctSRgbColor = ctSolidColorFillProperties.AddNewSrgbClr(); ctSRgbColor.val = fillColor; } }
public static CT_TextCharacterProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_TextCharacterProperties ctObj = new CT_TextCharacterProperties(); ctObj.kumimoji = XmlHelper.ReadBool(node.Attributes["kumimoji"]); ctObj.lang = XmlHelper.ReadString(node.Attributes["lang"]); ctObj.altLang = XmlHelper.ReadString(node.Attributes["altLang"]); ctObj.sz = XmlHelper.ReadInt(node.Attributes["sz"]); if (node.Attributes["b"] != null) { ctObj.b = XmlHelper.ReadBool(node.Attributes["b"]); } if (node.Attributes["i"] != null) { ctObj.i = XmlHelper.ReadBool(node.Attributes["i"]); } if (node.Attributes["u"] != null) { ctObj.u = (ST_TextUnderlineType)Enum.Parse(typeof(ST_TextUnderlineType), node.Attributes["u"].Value); } if (node.Attributes["strike"] != null) { ctObj.strike = (ST_TextStrikeType)Enum.Parse(typeof(ST_TextStrikeType), node.Attributes["strike"].Value); } ctObj.kern = XmlHelper.ReadInt(node.Attributes["kern"]); if (node.Attributes["cap"] != null) { ctObj.cap = (ST_TextCapsType)Enum.Parse(typeof(ST_TextCapsType), node.Attributes["cap"].Value); } ctObj.spc = XmlHelper.ReadInt(node.Attributes["spc"]); ctObj.normalizeH = XmlHelper.ReadBool(node.Attributes["normalizeH"]); ctObj.baseline = XmlHelper.ReadInt(node.Attributes["baseline"]); ctObj.noProof = XmlHelper.ReadBool(node.Attributes["noProof"]); if (node.Attributes["dirty"] != null) { ctObj.dirty = XmlHelper.ReadBool(node.Attributes["dirty"]); } ctObj.err = XmlHelper.ReadBool(node.Attributes["err"]); if (node.Attributes["smtClean"] != null) { ctObj.smtClean = XmlHelper.ReadBool(node.Attributes["smtClean"]); } ctObj.smtId = XmlHelper.ReadUInt(node.Attributes["smtId"]); ctObj.bmk = XmlHelper.ReadString(node.Attributes["bmk"]); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "ln") { ctObj.ln = CT_LineProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "noFill") { ctObj.noFill = new CT_NoFillProperties(); } else if (childNode.LocalName == "solidFill") { ctObj.solidFill = CT_SolidColorFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "gradFill") { ctObj.gradFill = CT_GradientFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "blipFill") { ctObj.blipFill = CT_BlipFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "pattFill") { ctObj.pattFill = CT_PatternFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "grpFill") { ctObj.grpFill = new CT_GroupFillProperties(); } else if (childNode.LocalName == "effectLst") { ctObj.effectLst = CT_EffectList.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "effectDag") { ctObj.effectDag = CT_EffectContainer.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "highlight") { ctObj.highlight = CT_Color.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "uLnTx") { ctObj.uLnTx = new CT_TextUnderlineLineFollowText(); } else if (childNode.LocalName == "uLn") { ctObj.uLn = CT_LineProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "uFillTx") { ctObj.uFillTx = new CT_TextUnderlineFillFollowText(); } else if (childNode.LocalName == "uFill") { ctObj.uFill = CT_TextUnderlineFillGroupWrapper.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "latin") { ctObj.latin = CT_TextFont.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "ea") { ctObj.ea = CT_TextFont.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "cs") { ctObj.cs = CT_TextFont.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "sym") { ctObj.sym = CT_TextFont.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "hlinkClick") { ctObj.hlinkClick = CT_Hyperlink.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "hlinkMouseOver") { ctObj.hlinkMouseOver = CT_Hyperlink.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "extLst") { ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager); } } return(ctObj); }
public CT_SolidColorFillProperties AddNewSolidFill() { this.solidFillField = new CT_SolidColorFillProperties(); return(solidFillField); }
public CT_SolidColorFillProperties AddNewSolidFill() { this.solidFillField = new CT_SolidColorFillProperties(); return this.solidFillField; }
public static CT_LineProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_LineProperties ctObj = new CT_LineProperties(); ctObj.w = XmlHelper.ReadInt(node.Attributes["w"]); if (node.Attributes["cap"] != null) { ctObj.cap = (ST_LineCap)Enum.Parse(typeof(ST_LineCap), node.Attributes["cap"].Value); } if (node.Attributes["cmpd"] != null) { ctObj.cmpd = (ST_CompoundLine)Enum.Parse(typeof(ST_CompoundLine), node.Attributes["cmpd"].Value); } if (node.Attributes["algn"] != null) { ctObj.algn = (ST_PenAlignment)Enum.Parse(typeof(ST_PenAlignment), node.Attributes["algn"].Value); } ctObj.custDash = new List <CT_DashStop>(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "noFill") { ctObj.noFill = new CT_NoFillProperties(); } else if (childNode.LocalName == "solidFill") { ctObj.solidFill = CT_SolidColorFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "gradFill") { ctObj.gradFill = CT_GradientFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "pattFill") { ctObj.pattFill = CT_PatternFillProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "prstDash") { ctObj.prstDash = CT_PresetLineDashProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "round") { ctObj.round = new CT_LineJoinRound(); } else if (childNode.LocalName == "bevel") { ctObj.bevel = new CT_LineJoinBevel(); } else if (childNode.LocalName == "miter") { ctObj.miter = CT_LineJoinMiterProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "headEnd") { ctObj.headEnd = CT_LineEndProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "tailEnd") { ctObj.tailEnd = CT_LineEndProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "extLst") { ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "custDash") { ctObj.custDash.Add(CT_DashStop.Parse(childNode, namespaceManager)); } } return(ctObj); }
private static void ApplyAttributes(CT_RPrElt pr, CT_TextCharacterProperties rPr) { if (pr.sizeOfBArray() > 0) { rPr.b = pr.GetBArray(0).val; } if (pr.sizeOfUArray() > 0) { switch (pr.GetUArray(0).val) { case ST_UnderlineValues.none: rPr.u = ST_TextUnderlineType.none; break; case ST_UnderlineValues.single: rPr.u = ST_TextUnderlineType.sng; break; case ST_UnderlineValues.@double: rPr.u = ST_TextUnderlineType.dbl; break; } } if (pr.sizeOfIArray() > 0) { rPr.i = pr.GetIArray(0).val; } if (pr.sizeOfFamilyArray() > 0) { rPr.AddNewLatin().typeface = pr.GetRFontArray(0).val; } if (pr.sizeOfSzArray() > 0) { int num = (int)(pr.GetSzArray(0).val * 100.0); rPr.sz = num; } if (pr.sizeOfColorArray() <= 0) { return; } CT_SolidColorFillProperties colorFillProperties = rPr.IsSetSolidFill() ? rPr.solidFill : rPr.AddNewSolidFill(); NPOI.OpenXmlFormats.Spreadsheet.CT_Color colorArray = pr.GetColorArray(0); if (colorArray.IsSetRgb()) { (colorFillProperties.IsSetSrgbClr() ? colorFillProperties.srgbClr : colorFillProperties.AddNewSrgbClr()).val = colorArray.rgb; } else { if (!colorArray.IsSetIndexed()) { return; } HSSFColor hssfColor = HSSFColor.GetIndexHash()[(object)(int)colorArray.indexed] as HSSFColor; if (hssfColor == null) { return; } byte[] numArray = new byte[3] { (byte)hssfColor.GetTriplet()[0], (byte)hssfColor.GetTriplet()[1], (byte)hssfColor.GetTriplet()[2] }; (colorFillProperties.IsSetSrgbClr() ? colorFillProperties.srgbClr : colorFillProperties.AddNewSrgbClr()).val = numArray; } }
/** * org.Openxmlformats.schemas.spreadsheetml.x2006.main.CTRPrElt to * org.Openxmlformats.schemas.Drawingml.x2006.main.CTFont adapter */ private static void ApplyAttributes(CT_RPrElt pr, CT_TextCharacterProperties rPr) { if (pr.SizeOfBArray() > 0) { rPr.b = (/*setter*/ pr.GetBArray(0).val); } if (pr.SizeOfUArray() > 0) { ST_UnderlineValues u1 = pr.GetUArray(0).val; if (u1 == ST_UnderlineValues.single) { rPr.u = (/*setter*/ ST_TextUnderlineType.sng); } else if (u1 == ST_UnderlineValues.@double) { rPr.u = (/*setter*/ ST_TextUnderlineType.dbl); } else if (u1 == ST_UnderlineValues.none) { rPr.u = (/*setter*/ ST_TextUnderlineType.none); } } if (pr.SizeOfIArray() > 0) { rPr.i = (/*setter*/ pr.GetIArray(0).val); } if (pr.SizeOfRFontArray() > 0) { CT_TextFont rFont = rPr.IsSetLatin() ? rPr.latin : rPr.AddNewLatin(); rFont.typeface = (/*setter*/ pr.GetRFontArray(0).val); } if (pr.SizeOfSzArray() > 0) { int sz = (int)(pr.GetSzArray(0).val * 100); rPr.sz = (/*setter*/ sz); } if (pr.SizeOfColorArray() > 0) { CT_SolidColorFillProperties fill = rPr.IsSetSolidFill() ? rPr.solidFill : rPr.AddNewSolidFill(); NPOI.OpenXmlFormats.Spreadsheet.CT_Color xlsColor = pr.GetColorArray(0); if (xlsColor.IsSetRgb()) { CT_SRgbColor clr = fill.IsSetSrgbClr() ? fill.srgbClr : fill.AddNewSrgbClr(); clr.val = (/*setter*/ xlsColor.rgb); } else if (xlsColor.IsSetIndexed()) { HSSFColor indexed = (HSSFColor)HSSFColor.GetIndexHash()[((int)xlsColor.indexed)]; if (indexed != null) { byte[] rgb = new byte[3]; rgb[0] = (byte)indexed.GetTriplet()[0]; rgb[1] = (byte)indexed.GetTriplet()[1]; rgb[2] = (byte)indexed.GetTriplet()[2]; CT_SRgbColor clr = fill.IsSetSrgbClr() ? fill.srgbClr : fill.AddNewSrgbClr(); clr.val = (/*setter*/ rgb); } } } }