示例#1
0
        public XSSFColor GetThemeColor(int idx)
        {
            CT_ColorScheme clrScheme = this.theme.GetTheme().themeElements.clrScheme;
            int            num       = 0;

            foreach (NPOI.OpenXmlFormats.Dml.CT_Color ctColor1 in new List <NPOI.OpenXmlFormats.Dml.CT_Color>()
            {
                clrScheme.dk1, clrScheme.lt1, clrScheme.dk2, clrScheme.lt2, clrScheme.accent1, clrScheme.accent2, clrScheme.accent3, clrScheme.accent4, clrScheme.accent5, clrScheme.accent6, clrScheme.hlink, clrScheme.folHlink
            })
            {
                if (num == idx)
                {
                    NPOI.OpenXmlFormats.Dml.CT_Color ctColor2 = ctColor1;
                    byte[] rgb = (byte[])null;
                    if (ctColor2.srgbClr != null)
                    {
                        rgb = ctColor2.srgbClr.val;
                    }
                    else if (ctColor2.sysClr != null)
                    {
                        rgb = ctColor2.sysClr.lastClr;
                    }
                    return(new XSSFColor(rgb));
                }
                ++num;
            }
            return((XSSFColor)null);
        }
示例#2
0
        /**
         * Convert a theme "index" into a color.
         * @param idx A theme "index"
         * @return The mapped XSSFColor, or null if not mapped.
         */
        public XSSFColor GetThemeColor(int idx)
        {
            // Theme color references are NOT positional indices into the color scheme,
            // i.e. these keys are NOT the same as the order in which theme colors appear
            // in theme1.xml. They are keys to a mapped color.
            CT_ColorScheme colorScheme = theme.GetTheme().themeElements.clrScheme;

            NPOI.OpenXmlFormats.Dml.CT_Color ctColor = null;

            switch (idx)
            {
            case THEME_LT1: ctColor = colorScheme.lt1; break;

            case THEME_DK1: ctColor = colorScheme.dk1; break;

            case THEME_LT2: ctColor = colorScheme.lt2; break;

            case THEME_DK2: ctColor = colorScheme.dk2; break;

            case THEME_ACCENT1: ctColor = colorScheme.accent1; break;

            case THEME_ACCENT2: ctColor = colorScheme.accent2; break;

            case THEME_ACCENT3: ctColor = colorScheme.accent3; break;

            case THEME_ACCENT4: ctColor = colorScheme.accent4; break;

            case THEME_ACCENT5: ctColor = colorScheme.accent5; break;

            case THEME_ACCENT6: ctColor = colorScheme.accent6; break;

            case THEME_HLINK: ctColor = colorScheme.hlink; break;

            case THEME_FOLHLINK: ctColor = colorScheme.folHlink; break;

            default: return(null);
            }

            byte[] rgb = null;
            if (ctColor.IsSetSrgbClr())
            {
                // Color is a regular one
                rgb = ctColor.srgbClr.val;
            }
            else if (ctColor.IsSetSysClr())
            {
                // Color is a tint of white or black
                rgb = ctColor.sysClr.lastClr;
            }
            else
            {
                return(null);
            }
            return(new XSSFColor(rgb));
        }
示例#3
0
 public CT_ColorScheme()
 {
     this.extLstField = new CT_OfficeArtExtensionList();
     this.folHlinkField = new CT_Color();
     this.hlinkField = new CT_Color();
     this.accent6Field = new CT_Color();
     this.accent5Field = new CT_Color();
     this.accent4Field = new CT_Color();
     this.accent3Field = new CT_Color();
     this.accent2Field = new CT_Color();
     this.accent1Field = new CT_Color();
     this.lt2Field = new CT_Color();
     this.dk2Field = new CT_Color();
     this.lt1Field = new CT_Color();
     this.dk1Field = new CT_Color();
 }
示例#4
0
        public XSSFColor GetThemeColor(int idx)
        {
            CT_ColorScheme colorScheme = theme.GetTheme().themeElements.clrScheme;

            NPOI.OpenXmlFormats.Dml.CT_Color ctColor = null;

            int cnt = 0;
            List <NPOI.OpenXmlFormats.Dml.CT_Color> colors = new List <NPOI.OpenXmlFormats.Dml.CT_Color>();

            colors.Add(colorScheme.dk1);
            colors.Add(colorScheme.lt1);
            colors.Add(colorScheme.dk2);
            colors.Add(colorScheme.lt2);
            colors.Add(colorScheme.accent1);
            colors.Add(colorScheme.accent2);
            colors.Add(colorScheme.accent3);
            colors.Add(colorScheme.accent4);
            colors.Add(colorScheme.accent5);
            colors.Add(colorScheme.accent6);
            colors.Add(colorScheme.hlink);
            colors.Add(colorScheme.folHlink);

            //iterate ctcolors in colorschema
            foreach (NPOI.OpenXmlFormats.Dml.CT_Color color in colors)
            {
                if (cnt == idx)
                {
                    ctColor = color;

                    byte[] rgb = null;
                    if (ctColor.srgbClr != null)
                    {
                        // Colour is a regular one
                        rgb = ctColor.srgbClr.val;
                    }
                    else if (ctColor.sysClr != null)
                    {
                        // Colour is a tint of white or black
                        rgb = ctColor.sysClr.lastClr;
                    }

                    return(new XSSFColor(rgb));
                }
                cnt++;
            }
            return(null);
        }
示例#5
0
 public CT_ColorChangeEffect()
 {
     this.clrToField = new CT_Color();
     this.clrFromField = new CT_Color();
     this.useAField = true;
 }
示例#6
0
 public CT_PatternFillProperties()
 {
     this.bgClrField = new CT_Color();
     this.fgClrField = new CT_Color();
 }
示例#7
0
文件: BaseTypes.cs 项目: 89sos98/npoi
 public static CT_Color Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Color ctObj = new CT_Color();
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "scrgbClr")
             ctObj.scrgbClr = CT_ScRgbColor.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "srgbClr")
             ctObj.srgbClr = CT_SRgbColor.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "hslClr")
             ctObj.hslClr = CT_HslColor.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "sysClr")
             ctObj.sysClr = CT_SystemColor.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "schemeClr")
             ctObj.schemeClr = CT_SchemeColor.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "prstClr")
             ctObj.prstClr = CT_PresetColor.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
示例#8
0
 public CT_Color AddNewBuClr()
 {
     this.buClrField = new CT_Color();
     return this.buClrField;
 }
示例#9
0
 public void UnsetBuClr()
 {
     this.buClrField = null;
 }
示例#10
0
 public CT_Shape3D() {
     this.extLstField = new CT_OfficeArtExtensionList();
     this.contourClrField = new CT_Color();
     this.extrusionClrField = new CT_Color();
     this.bevelBField = new CT_Bevel();
     this.bevelTField = new CT_Bevel();
     this.zField = ((long)(0));
     this.extrusionHField = ((long)(0));
     this.contourWField = ((long)(0));
     this.prstMaterialField = ST_PresetMaterialType.warmMatte;
 }
示例#11
0
 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));
 }
示例#12
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();
 }