/// <summary> /// Gets the text decoration. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextDecorationEnum GetTextDecoration(string v, TextDecorationEnum def) { TextDecorationEnum td; switch (v.ToLower()) { case "underline": td = TextDecorationEnum.Underline; break; case "overline": td = TextDecorationEnum.Overline; break; case "linethrough": td = TextDecorationEnum.LineThrough; break; case "none": td = TextDecorationEnum.None; break; default: td = def; break; } return(td); }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; FontSize = 10; FontWeight = FontWeightEnum.Normal; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant = 1; }
/// <summary> /// Gets the text decoration. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextDecorationEnum GetTextDecoration(string v, TextDecorationEnum def) { TextDecorationEnum td; try { td = (TextDecorationEnum)Enum.Parse(typeof(TextDecorationEnum), v); } catch { td = def; } return(td); }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; //WRP 291008 numFmtId should be 0 (Zero) for General format - will be interpreted as a string //It has default values in Excel07 as per ECMA-376 standard (SEction 3.8.30) for Office Open XML Excel07 _Format = "General"; FontSize = 10; FontWeight = FontWeightEnum.Normal; PatternType = patternTypeEnum.None; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant = 1; }
/// <summary> /// Gets the text decoration. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextDecorationEnum GetTextDecoration(string v, TextDecorationEnum def) { TextDecorationEnum td; try { td = (TextDecorationEnum)Enum.Parse(typeof(TextDecorationEnum), v); } catch { td = def; } return td; }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; //WRP 291008 numFmtId should be 0 (Zero) for General format - will be interpreted as a string //It has default values in Excel07 as per ECMA-376 standard (SEction 3.8.30) for Office Open XML Excel07 _Format = "General"; FontSize = 10; FontWeight = FontWeightEnum.Normal; PatternType = patternTypeEnum.None; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant=1; }
/// <summary> /// Gets the text decoration. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static TextDecorationEnum GetTextDecoration(string v, TextDecorationEnum def) { TextDecorationEnum td; switch (v.ToLower()) { case "underline": td = TextDecorationEnum.Underline; break; case "overline": td = TextDecorationEnum.Overline; break; case "linethrough": td = TextDecorationEnum.LineThrough; break; case "none": td = TextDecorationEnum.None; break; default: td = def; break; } return td; }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; FontSize = 10; FontWeight = FontWeightEnum.Normal; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.Left; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant=1; }
/// <summary> /// Add image to the page. Adds a new XObject Image and a reference to it. /// </summary> /// <returns>string Image name</returns> //internal string AddImage(PdfImages images, string name, int contentRef, StyleInfo si, // ImageFormat imf, float x, float y, float width, float height, // byte[] im, int samplesW, int samplesH, string url) //{ // string imgname = images.GetPdfImage(this.p, name, contentRef, imf, im, samplesW, samplesH); // elements.AppendFormat(NumberFormatInfo.InvariantInfo, // "\r\nq\t{2} 0 0 {3} {0} {1} cm\t", // x, pSize.yHeight - y - height, width, height); // push graphics state, positioning // elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\t/{0} Do\tQ\t", imgname); // do the image then pop graphics state // if (url != null) // p.AddHyperlink(x, pSize.yHeight - y, height, width, url); // // Border goes around the image padding // AddBorder(si, x - si.PaddingLeft, y - si.PaddingTop, // height + si.PaddingTop + si.PaddingBottom, // width + si.PaddingLeft + si.PaddingRight); // add any required border // return imgname; //} /// <summary> /// Page Text element at the X Y position; multiple lines handled /// </summary> /// <returns></returns> internal void AddText(decimal x1, decimal y1, decimal x2, decimal y2, string text, Color color, Rdl.Pdf.Font font, int fontSize, int lineHeight, string url, WritingModeEnum writingMode, TextDecorationEnum textDecoration) { // Calculate the RGB colors e.g. RGB(255, 0, 0) = red = 1 0 0 rg double r = color.R; double g = color.G; double b = color.B; r = Math.Round((r / 255), 3); g = Math.Round((g / 255), 3); b = Math.Round((b / 255), 3); // Make sure the font used is included in the fonts for this page. if (!_fontsUsed.ContainsKey(font.Name)) { _fontsUsed.Add(font.Name, font); } // Set the clipping path _contents.AppendFormat(NumberFormatInfo.InvariantInfo, "q {0} {1} {2} {3} re W n", x1, y1, x2, y2); if (url != null) { AddHyperlink(x1, y2, x2, y2, url); } // Escape the text text = text.Replace("\\", "\\\\").Replace("(", "\\(").Replace(")", "\\)"); if (writingMode == WritingModeEnum.lr_tb) { _contents.AppendFormat(NumberFormatInfo.InvariantInfo, " BT /{0} {1} Tf {3} {4} {5} rg {6} {7} Td ({2}) Tj ET Q\n", font.Name, fontSize, text, r, g, b, x1, y1 + font.Descent); } //else //{ // Rotate text -90 degrees=-.5 radians (this works for english don't know about true tb-rl language) // // had to play with reader to find best approximation for this rotation; didn't do what I expected // // see pdf spec section 4.2.2 pg 141 "Common Transformations" // elements.AppendFormat(NumberFormatInfo.InvariantInfo, // "\r\nBT/{0} 0 R {1} Tf\t{5} {6} {7} rg\t{8} {9} {10} {11} {2} {3} Tm \t({4}) Tj\tET\tQ\t", // font.Id, fontSize, x1, (pSize.yHeight - startY), text, r, g, b, // radsCos, radsSin, -radsSin, radsCos); //} // Handle underlining etc. switch (textDecoration) { case TextDecorationEnum.Underline: AddLine(x1, y1, x2, y1, 1, color, LineStyleEnum.Solid); break; case TextDecorationEnum.LineThrough: AddLine(x1, (y1 + y2) / 2, x2, (y1 + y2) / 2, 1, color, LineStyleEnum.Solid); break; case TextDecorationEnum.Overline: AddLine(x1, y2, x2, y2, 1, color, LineStyleEnum.Solid); break; case TextDecorationEnum.None: default: break; } }
public void SetTextDecoration(TextDecorationEnum textDecor) { textDecoration = textDecor; }