Exemple #1
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 = indexed.RGB;
                        CT_SRgbColor clr = fill.IsSetSrgbClr() ? fill.srgbClr : fill.AddNewSrgbClr();
                        clr.val = (rgb);
                    }
                }
            }
        }
Exemple #2
0
 public bool Equals(ST_UnderlineValues other)
 {
     if (other == (ST_UnderlineValues)null)
     {
         return(false);
     }
     return(this._ooxmlEnumerationValue == other._ooxmlEnumerationValue);
 }
Exemple #3
0
 static ST_UnderlineValues()
 {
     ST_UnderlineValues.single           = new ST_UnderlineValues("single");
     ST_UnderlineValues._double          = new ST_UnderlineValues("double");
     ST_UnderlineValues.singleAccounting = new ST_UnderlineValues("singleAccounting");
     ST_UnderlineValues.doubleAccounting = new ST_UnderlineValues("doubleAccounting");
     ST_UnderlineValues.none             = new ST_UnderlineValues("none");
 }
 static ST_UnderlineValues()
 {
     single           = new ST_UnderlineValues("single");
     _double          = new ST_UnderlineValues("double");
     singleAccounting = new ST_UnderlineValues("singleAccounting");
     doubleAccounting = new ST_UnderlineValues("doubleAccounting");
     none             = new ST_UnderlineValues("none");
 }
Exemple #5
0
 /**
  * set an enumeration representing the style of underlining that is used.
  * The none style is equivalent to not using underlining at all.
  * The possible values for this attribute are defined by the FontUnderline
  *
  * @param underline - FontUnderline enum value
  */
 internal void SetUnderline(FontUnderlineType underline)
 {
     if (underline == FontUnderlineType.None)
     {
         _ctFont.SetUArray(null);
     }
     else
     {
         CT_UnderlineProperty ctUnderline = _ctFont.sizeOfUArray() == 0 ? _ctFont.AddNewU() : _ctFont.GetUArray(0);
         ST_UnderlineValues   val         = (ST_UnderlineValues)FontUnderline.ValueOf(underline).Value;
         ctUnderline.val = val;
     }
 }
Exemple #6
0
 /**
  * set an enumeration representing the style of underlining that is used.
  * The none style is equivalent to not using underlining at all.
  * The possible values for this attribute are defined by the FontUnderline
  *
  * @param underline - FontUnderline enum value
  */
 public void SetUnderline(FontUnderline underline)
 {
     if (underline == FontUnderline.NONE && _ctFont.sizeOfUArray() > 0)
     {
         _ctFont.SetUArray(null);
     }
     else
     {
         CT_UnderlineProperty ctUnderline = _ctFont.sizeOfUArray() == 0 ? _ctFont.AddNewU() : _ctFont.GetUArray(0);
         ST_UnderlineValues   val         = (ST_UnderlineValues)underline.Value;
         ctUnderline.val = val;
     }
 }
Exemple #7
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 = (/*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);
                    }
                }
            }
        }
 public CT_UnderlineProperty()
 {
     this.valField = ST_UnderlineValues.single;
 }