Beispiel #1
0
 public XSSFLineBreak(CT_RegularTextRun r, XSSFTextParagraph p, CT_TextCharacterProperties brProps)
     : base(r, p)
 {
     _brProps = brProps;
 }
Beispiel #2
0
 public CT_TextCharacterProperties AddNewEndParaRPr()
 {
     this.endParaRPrField=new CT_TextCharacterProperties();
     return this.endParaRPrField;
 }
Beispiel #3
0
        /**
         *
         * 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 = 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 = (rgb);
                    }
                }
            }
        }
Beispiel #4
0
 public CT_TextCharacterProperties AddNewRPr()
 {
     this.rPrField = new CT_TextCharacterProperties();
     return rPrField;
 }
Beispiel #5
0
 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"]);
     ctObj.b = XmlHelper.ReadBool(node.Attributes["b"]);
     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"]);
     ctObj.dirty = XmlHelper.ReadBool(node.Attributes["dirty"]);
     ctObj.err = XmlHelper.ReadBool(node.Attributes["err"]);
     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;
 }
Beispiel #6
0
        /**
         *
         * CT_RPrElt --> 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) rPr.SetU(pr.GetUArray(0).GetVal());
            if (pr.sizeOfIArray() > 0) rPr.i = (pr.GetIArray(0).val);

            CT_TextFont rFont = rPr.AddNewLatin();
            rFont.typeface = (pr.sizeOfRFontArray() > 0 ? pr.GetRFontArray(0).val : "Arial");
        }
Beispiel #7
0
 public CT_TextLineBreak()
 {
     this.rPrField = new CT_TextCharacterProperties();
 }
Beispiel #8
0
 public CT_TextField()
 {
     this.pPrField = new CT_TextParagraphProperties();
     this.rPrField = new CT_TextCharacterProperties();
 }
Beispiel #9
0
 public CT_TextParagraphProperties()
 {
     this.extLstField = new CT_OfficeArtExtensionList();
     this.defRPrField = new CT_TextCharacterProperties();
     this.tabLstField = new List<CT_TextTabStop>();
     this.buBlipField = new CT_TextBlipBullet();
     this.buCharField = new CT_TextCharBullet();
     this.buAutoNumField = new CT_TextAutonumberBullet();
     this.buNoneField = new CT_TextNoBullet();
     this.buFontField = new CT_TextFont();
     this.buFontTxField = new CT_TextBulletTypefaceFollowText();
     this.buSzPtsField = new CT_TextBulletSizePoint();
     this.buSzPctField = new CT_TextBulletSizePercent();
     this.buSzTxField = new CT_TextBulletSizeFollowText();
     this.buClrField = new CT_Color();
     this.buClrTxField = new CT_TextBulletColorFollowText();
     this.spcAftField = new CT_TextSpacing();
     this.spcBefField = new CT_TextSpacing();
     this.lnSpcField = new CT_TextSpacing();
 }
Beispiel #10
0
        public static CT_TextParagraphProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_TextParagraphProperties ctObj = new CT_TextParagraphProperties();

            ctObj.marL   = XmlHelper.ReadInt(node.Attributes["marL"]);
            ctObj.marR   = XmlHelper.ReadInt(node.Attributes["marR"]);
            ctObj.lvl    = XmlHelper.ReadInt(node.Attributes["lvl"]);
            ctObj.indent = XmlHelper.ReadInt(node.Attributes["indent"]);
            if (node.Attributes["algn"] != null)
            {
                ctObj.algn = (ST_TextAlignType)Enum.Parse(typeof(ST_TextAlignType), node.Attributes["algn"].Value);
            }
            else
            {
                ctObj.algn = ST_TextAlignType.l;
            }
            ctObj.defTabSz = XmlHelper.ReadInt(node.Attributes["defTabSz"]);
            ctObj.rtl      = XmlHelper.ReadBool(node.Attributes["rtl"]);
            ctObj.eaLnBrk  = XmlHelper.ReadBool(node.Attributes["eaLnBrk"]);
            if (node.Attributes["fontAlgn"] != null)
            {
                ctObj.fontAlgn = (ST_TextFontAlignType)Enum.Parse(typeof(ST_TextFontAlignType), node.Attributes["fontAlgn"].Value);
            }
            ctObj.latinLnBrk   = XmlHelper.ReadBool(node.Attributes["latinLnBrk"]);
            ctObj.hangingPunct = XmlHelper.ReadBool(node.Attributes["hangingPunct"]);

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "lnSpc")
                {
                    ctObj.lnSpc = CT_TextSpacing.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "spcBef")
                {
                    ctObj.spcBef = CT_TextSpacing.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "spcAft")
                {
                    ctObj.spcAft = CT_TextSpacing.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "buClrTx")
                {
                    ctObj.buClrTx = new CT_TextBulletColorFollowText();
                }
                else if (childNode.LocalName == "buClr")
                {
                    ctObj.buClr = CT_Color.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "buSzTx")
                {
                    ctObj.buSzTx = new CT_TextBulletSizeFollowText();
                }
                else if (childNode.LocalName == "buSzPct")
                {
                    ctObj.buSzPct = CT_TextBulletSizePercent.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "buSzPts")
                {
                    ctObj.buSzPts = CT_TextBulletSizePoint.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "buFontTx")
                {
                    ctObj.buFontTx = new CT_TextBulletTypefaceFollowText();
                }
                else if (childNode.LocalName == "buFont")
                {
                    ctObj.buFont = CT_TextFont.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "buNone")
                {
                    ctObj.buNone = new CT_TextNoBullet();
                }
                else if (childNode.LocalName == "buAutoNum")
                {
                    ctObj.buAutoNum = CT_TextAutonumberBullet.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "buChar")
                {
                    ctObj.buChar = CT_TextCharBullet.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "buBlip")
                {
                    ctObj.buBlip = CT_TextBlipBullet.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "defRPr")
                {
                    ctObj.defRPr = CT_TextCharacterProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "extLst")
                {
                    ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "tabLst")
                {
                    ctObj.tabLst = CT_TextTabStopList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Beispiel #11
0
 public CT_TextCharacterProperties AddNewEndParaRPr()
 {
     this.endParaRPrField = new CT_TextCharacterProperties();
     return(this.endParaRPrField);
 }
Beispiel #12
0
 public CT_TextCharacterProperties AddNewRPr()
 {
     this.rPr = new CT_TextCharacterProperties();
     return(rPr);
 }
Beispiel #13
0
        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);
        }