示例#1
0
        private void DoStyle(Style style, Row row)
        {
            if (style == null)
                return;

            StyleInfo si = style.GetStyleInfo(r, row);

            //            tw.Write(@"\plain");        // reset current attributes

            // Handle the font
            if (!_Fonts.Contains(si.FontFamily))
                _Fonts.Add(si.FontFamily);
            int fc = _Fonts.IndexOf(si.FontFamily);

            tw.Write(@"\f{0} ", fc);

            if (si.IsFontBold())
                tw.Write(@"\b");
            if (si.FontStyle== FontStyleEnum.Italic)
                tw.Write(@"\i");
            switch (si.TextDecoration)
            {
                case TextDecorationEnum.Underline:
                    tw.Write(@"\ul");
                    break;
                case TextDecorationEnum.LineThrough:
                    tw.Write(@"\strike");
                    break;
                default:
                    break;
            }

            tw.Write(@"\fs{0}", (int) Math.Round(si.FontSize * 2,0));        // font size

            // Handle the color
            int ic;
            if (!_Colors.Contains(si.Color))
                _Colors.Add(si.Color);
            ic = _Colors.IndexOf(si.Color)+1;

            tw.Write(@"\cf{0} ", ic);
        }
        private StyleInfo GetStyle(Style style, Row row)
        {
            if (style == null)
                return null;

            return style.GetStyleInfo(base.Report(), row);
        }