Exemplo n.º 1
0
        private string GetXMLBorders(ExportIEMStyle style)
        {
            StringBuilder result = new StringBuilder(128);

            result.AppendLine("<Borders>");
            if ((style.Border.Lines & BorderLines.Left) > 0)
            {
                result.Append("<Border ss:Position=\"Left\" ").
                Append("ss:LineStyle=\"").
                AppendFormat(GetXMLLineStyle(style.Border.LeftLine.Style)).
                Append("\" ").
                Append("ss:Weight=\"").
                Append(GetXMLWeight(style.Border.LeftLine.Width)).
                Append("\" ").
                Append("ss:Color=\"").
                Append(ExportUtils.HTMLColor(style.Border.LeftLine.Color)).
                AppendLine("\"/>");
            }
            if ((style.Border.Lines & BorderLines.Top) > 0)
            {
                result.Append("<Border ss:Position=\"Top\" ").
                Append("ss:LineStyle=\"").
                AppendFormat(GetXMLLineStyle(style.Border.TopLine.Style)).
                Append("\" ").
                Append("ss:Weight=\"").
                Append(GetXMLWeight(style.Border.TopLine.Width)).
                Append("\" ").
                Append("ss:Color=\"").
                Append(ExportUtils.HTMLColor(style.Border.TopLine.Color)).
                AppendLine("\"/>");
            }
            if ((style.Border.Lines & BorderLines.Bottom) > 0)
            {
                result.AppendLine("<Border ss:Position=\"Bottom\" ").
                Append("ss:LineStyle=\"").
                AppendFormat(GetXMLLineStyle(style.Border.BottomLine.Style)).
                Append("\" ").
                Append("ss:Weight=\"").
                Append(GetXMLWeight(style.Border.BottomLine.Width)).
                Append("\" ").
                Append("ss:Color=\"").
                Append(ExportUtils.HTMLColor(style.Border.BottomLine.Color)).
                AppendLine("\"/>");
            }
            if ((style.Border.Lines & BorderLines.Right) > 0)
            {
                result.AppendLine("<Border ss:Position=\"Right\" ").
                Append("ss:LineStyle=\"").
                AppendFormat(GetXMLLineStyle(style.Border.RightLine.Style)).
                Append("\" ").
                Append("ss:Weight=\"").
                Append(GetXMLWeight(style.Border.RightLine.Width)).
                Append("\" ").
                Append("ss:Color=\"").
                Append(ExportUtils.HTMLColor(style.Border.RightLine.Color)).
                AppendLine("\"/>");
            }
            result.Append("</Borders>");
            return(result.ToString());
        }
Exemplo n.º 2
0
 private string GetXMLInterior(ExportIEMStyle style)
 {
     if (style.FillColor != Color.Transparent)
     {
         return("<Interior ss:Color=\"" +
                ExportUtils.HTMLColor(style.FillColor) + "\" ss:Pattern=\"Solid\"/>");
     }
     return(String.Empty);
 }
Exemplo n.º 3
0
 private void OdfTableCellStyles(ExportIEMStyle Style, StreamWriter Out)
 {
     Out.Write("<style:table-cell-properties fo:background-color=\"" +
               ExportUtils.HTMLColor(Style.FillColor) + "\" " +
               "style:repeat-content=\"false\" fo:wrap-option=\"wrap\" ");
     if (Style.Angle > 0)
     {
         Out.Write("style:rotation-angle=\"" + (360 - Style.Angle).ToString() + "\" " +
                   "style:rotation-align=\"none\" ");
     }
     if (Style.VAlign == VertAlign.Center)
     {
         Out.Write("style:vertical-align=\"middle\" ");
     }
     if (Style.VAlign == VertAlign.Top)
     {
         Out.Write("style:vertical-align=\"top\" ");
     }
     if (Style.VAlign == VertAlign.Bottom)
     {
         Out.Write("style:vertical-align=\"bottom\" ");
     }
     if ((Style.Border.Lines & BorderLines.Left) > 0)
     {
         Out.Write("fo:border-left=\"" +
                   ExportUtils.FloatToString(Style.Border.Width / odfDivider) + "cm " +
                   OdfGetFrameName(Style.Border.Style) + " " +
                   ExportUtils.HTMLColor(Style.Border.Color) + "\" ");
     }
     if ((Style.Border.Lines & BorderLines.Right) > 0)
     {
         Out.Write("fo:border-right=\"" +
                   ExportUtils.FloatToString(Style.Border.Width / odfDivider) + "cm " +
                   OdfGetFrameName(Style.Border.Style) + " " +
                   ExportUtils.HTMLColor(Style.Border.Color) + "\" ");
     }
     if ((Style.Border.Lines & BorderLines.Top) > 0)
     {
         Out.Write("fo:border-top=\"" +
                   ExportUtils.FloatToString(Style.Border.Width / odfDivider) + "cm " +
                   OdfGetFrameName(Style.Border.Style) + " " +
                   ExportUtils.HTMLColor(Style.Border.Color) + "\" ");
     }
     if ((Style.Border.Lines & BorderLines.Bottom) > 0)
     {
         Out.Write("fo:border-bottom=\"" +
                   ExportUtils.FloatToString(Style.Border.Width / odfDivider) + "cm " +
                   OdfGetFrameName(Style.Border.Style) + " " +
                   ExportUtils.HTMLColor(Style.Border.Color) + "\" ");
     }
     Out.WriteLine("/>");
     Out.WriteLine("</style:style>");
 }
Exemplo n.º 4
0
 private string GetXMLFormat(ExportIEMStyle style)
 {
     if (style.Format is NumberFormat)
     {
         return("<NumberFormat ss:Format=\"Standard\"/>\r\n");
     }
     if (style.Format is CurrencyFormat && (style.Format as CurrencyFormat).UseLocale)
     {
         return("<NumberFormat ss:Format=\"Currency\"/>\r\n");
     }
     return(String.Empty);
 }
Exemplo n.º 5
0
        private string GetXMLFont(ExportIEMStyle style)
        {
            StringBuilder result = new StringBuilder(128);

            result.Append("<Font ss:FontName=\"").Append(style.Font.Name).Append("\" ss:Size=\"").
            Append(ExportUtils.FloatToString(style.Font.Size)).Append("\" ss:Color=\"").
            Append(ExportUtils.HTMLColor(style.TextColor)).Append("\" ").
            Append(((style.Font.Style & FontStyle.Bold) > 0 ? "ss:Bold=\"1\" " : String.Empty)).
            Append(((style.Font.Style & FontStyle.Italic) > 0 ? "ss:Italic=\"1\" " : String.Empty)).
            Append(((style.Font.Style & FontStyle.Underline) > 0 ? "ss:Underline=\"Single\" " : String.Empty)).
            Append("/>");
            return(result.ToString());
        }
Exemplo n.º 6
0
        private string GetXMLAlignment(ExportIEMStyle style)
        {
            StringBuilder result = new StringBuilder(64);

            result.Append("<Alignment ").Append(XmlAlign(style.HAlign, style.VAlign, style.Angle)).
            Append(" ss:WrapText=\"1\" ").
            Append(((style.Angle > 0 && style.Angle <= 90) ? "ss:Rotate=\"" + (-style.Angle).ToString() + "\"" : String.Empty)).
            Append(((style.Angle > 90 && style.Angle <= 180) ? "ss:Rotate=\"" + (180 - style.Angle).ToString() + "\"" : String.Empty)).
            Append(((style.Angle > 180 && style.Angle < 270) ? "ss:Rotate=\"" + (270 - style.Angle).ToString() + "\"" : String.Empty)).
            Append(((style.Angle >= 270 && style.Angle < 360) ? "ss:Rotate=\"" + (360 - style.Angle).ToString() + "\"" : String.Empty)).
            Append("/>");
            return(result.ToString());
        }
Exemplo n.º 7
0
        private string GetRTFBorders(ExportIEMStyle Style)
        {
            //// +debug
            //Style.Border.Lines = BorderLines.All;
            //Style.Border.Width = 1;
            //// -debug

            StringBuilder result = new StringBuilder(256);

            // top
            if ((Style.Border.Lines & BorderLines.Top) > 0)
            {
                result.Append("\\clbrdrt").
                Append(GetRTFLineStyle(Style.Border.TopLine.Style)).
                Append("\\brdrw").
                Append(((int)Math.Round(Style.Border.TopLine.Width * 20)).ToString()).
                Append("\\brdrcf").
                Append(GetRTFColorFromTable(GetRTFColor(Style.Border.TopLine.Color)));
            }
            // left
            if ((Style.Border.Lines & BorderLines.Left) > 0)
            {
                result.Append("\\clbrdrl").
                Append(GetRTFLineStyle(Style.Border.LeftLine.Style)).
                Append("\\brdrw").
                Append(((int)Math.Round(Style.Border.LeftLine.Width * 20)).ToString()).
                Append("\\brdrcf").
                Append(GetRTFColorFromTable(GetRTFColor(Style.Border.LeftLine.Color)));
            }
            // bottom
            if ((Style.Border.Lines & BorderLines.Bottom) > 0)
            {
                result.Append("\\clbrdrb").
                Append(GetRTFLineStyle(Style.Border.BottomLine.Style)).
                Append("\\brdrw").
                Append(((int)Math.Round(Style.Border.BottomLine.Width * 20)).ToString()).
                Append("\\brdrcf").
                Append(GetRTFColorFromTable(GetRTFColor(Style.Border.BottomLine.Color)));
            }
            // right
            if ((Style.Border.Lines & BorderLines.Right) > 0)
            {
                result.Append("\\clbrdrr").
                Append(GetRTFLineStyle(Style.Border.RightLine.Style)).
                Append("\\brdrw").
                Append(((int)Math.Round(Style.Border.RightLine.Width * 20)).ToString()).
                Append("\\brdrcf").
                Append(GetRTFColorFromTable(GetRTFColor(Style.Border.RightLine.Color)));
            }
            return(result.ToString());
        }
Exemplo n.º 8
0
 private void ExportPageStyles(StringBuilder styles, ExportMatrix FMatrix, int PageNumber)
 {
     if (FMatrix.StylesCount - FPrevStyleListIndex > 0)
     {
         styles.Append(HTMLGetStylesHeader(PageNumber));
         for (int i = FPrevStyleListIndex; i < FMatrix.StylesCount; i++)
         {
             ExportIEMStyle EStyle = FMatrix.StyleById(i);
             styles.Append(HTMLGetStyleHeader(i));
             HTMLGetStyle(styles, EStyle.Font, EStyle.TextColor, EStyle.FillColor, EStyle.HAlign, EStyle.VAlign, EStyle.Border, EStyle.Padding, EStyle.RTL);
         }
         styles.AppendLine(HTMLGetStylesFooter());
     }
 }
Exemplo n.º 9
0
        private string GetRTFString(ExportIEMStyle style, string text, float drow)
        {
            StringBuilder CellsStream = new StringBuilder();

            CellsStream.Append(GetRTFHAlignment(style.HAlign)).Append("{");
            CellsStream.Append("\\f").Append(GetRTFFontName(style.Font.Name));

            string s = StrToRTFUnicodeEx(ExportUtils.TruncReturns(text));

            if (s.Length > 0)
            {
                CellsStream.Append("\\fs").Append((Math.Round(style.Font.Size * 2)).ToString());
                CellsStream.Append(GetRTFFontStyle(style.Font.Style)).Append("\\cf");
                CellsStream.Append(GetRTFColorFromTable(GetRTFColor((style.TextColor))));
                CellsStream.Append(style.RTL ? "\\rtlch" : String.Empty);

                CellsStream.Append("\\sb").
                Append(((int)Math.Round(style.Padding.Top * YDiv)).ToString()).
                Append("\\sa").
                Append(((int)Math.Round(style.Padding.Bottom * YDiv)).ToString()).
                Append("\\li").
                Append(((int)Math.Round((style.Padding.Left / 2) * Xdivider)).ToString()).
                Append("\\ri").
                Append(((int)Math.Round((style.Padding.Right / 2) * Xdivider)).ToString()).
                Append("\\fi").
                Append(((int)Math.Round((style.FirstTabOffset) * Xdivider)).ToString()).
                Append("\\sl-").
                Append(((int)Math.Round((style.Font.Height) * FDpiFactor * YDiv * 0.98)).ToString()).
                Append("\\slmult0 ").
                Append(s);
            }
            else
            {
                int j = (int)(drow / FONT_DIVIDER);
                j = j > 20 ? 20 : j;
                CellsStream.Append("\\fs").Append(j.ToString());
            }

            CellsStream.Append("\\cell}");
            return(CellsStream.ToString());
        }