private static List <Run> GetRuns(ReportCommon common) { List <Run> runs = new List <Run>(); if (common is ReportValue) { ReportValue reportvalue = common as ReportValue; Run r = new Run(); RunProperties rP = GetRunProperties(reportvalue, true); r.Append(rP); string text = reportvalue.Text; if (text.EndsWith(":")) { text = text + " "; } if (!text.EndsWith(": ")) { text = text + ": "; } Text t = CreateText(text); r.Append(t); runs.Add(r); r = new Run(); rP = GetRunProperties(reportvalue, false); r.Append(rP); r.Append(CreateText(reportvalue.Value)); runs.Add(r); } else if (common is ReportImage) { ReportImage reportImage = common as ReportImage; Run r = new Run(); RunProperties rP = GetRunProperties(reportImage); Drawing image = GetImageToBody(reportImage.RId, reportImage.Width * 600, reportImage.Height * 800); //Drawing image = new Drawing(); //image.Append(new A.Blip() { Embed = new StringValue(reportImage.RId) }); r.Append(rP); r.Append(image); runs.Add(r); } else if (common is ReportText) { Run r = new Run(); RunProperties rP = GetRunProperties(common); r.Append(rP); r.Append(CreateText(common.Text)); runs.Add(r); } return(runs); }
public static RunProperties GetRunProperties(ReportCommon common, bool bBold = false) { RunProperties rPr = new RunProperties(); //Color color = new Color() { Val = "FF0000" }; // the color is red RunFonts rFont = new RunFonts(); rFont.Ascii = "Arial"; // the font is Arial //rPr.Append(color); //rPr.Append(rFont); if (common.IsBold || bBold) { rPr.Append(new Bold()); // it is Bold } //TextAlignment rPr.Append(new FontSize() { Val = new StringValue((common.Size * 2).ToString()) }); //font size (in 1/72 of an inch) return(rPr); }