private void WriteWorkSheetChart_chart_title_layout(ExcelChartTitle title, XElement titleElement) { XElement layoutElement = new XElement(XName.Get("layout", ExcelCommon.Schema_Chart)); titleElement.Add(layoutElement); }
private void WriteWorkSheetChart_chart_title_tx(ExcelChartTitle title, XElement titleElement) { XElement txElement = new XElement(XName.Get("tx", ExcelCommon.Schema_Chart)); if (string.IsNullOrEmpty(title.Text) == false) { XElement richElement = new XElement(XName.Get("rich", ExcelCommon.Schema_Chart)); XElement bodyPrElement = new XElement(XName.Get("bodyPr", ExcelCommon.Schema_Drawings)); if (title.AnchorCtr) bodyPrElement.Add(new XAttribute(XName.Get("anchorCtr"), "1")); if (title.TextHorz != default(ExcelTextHorzOverflowType)) bodyPrElement.Add(new XAttribute(XName.Get("horzOverflow"), title.TextHorz.ToString().ToLower())); bodyPrElement.Add(new XAttribute(XName.Get("anchor"), GetTextAchoringText(title.Anchor))); bodyPrElement.Add(new XAttribute(XName.Get("vert"), GetTextVerticalText(title.TextVertical))); if (title.Rotation != default(double)) { if (title.Rotation > 180) bodyPrElement.Add(new XAttribute(XName.Get("rot"), (int)((title.Rotation - 360) * 60000))); else bodyPrElement.Add(new XAttribute(XName.Get("rot"), (int)(title.Rotation * 60000))); } richElement.Add(bodyPrElement); richElement.Add(new XElement(XName.Get("lstStyle", ExcelCommon.Schema_Drawings))); foreach (Paragraph p in title.RichText) { WriteWorkSheetChart_chart_title_P(p, richElement); } txElement.Add(richElement); titleElement.Add(txElement); } }
private void WriteWorkSheetChart_chart_title_spPr(ExcelChartTitle title, XElement titleElement) { XElement spPrElement = new XElement(XName.Get("spPr", ExcelCommon.Schema_Chart)); if (title._Border != null || title._Fill != null) { XElement lnElement = new XElement(XName.Get("ln", ExcelCommon.Schema_Drawings)); WriteWorkSheetChart_chart_title_spPr_LnBorder(title._Border, lnElement); spPrElement.Add(lnElement); } titleElement.Add(spPrElement); }
private XElement WriteWorkSheetChart_chart_title(ExcelChartTitle title) { XElement titleElement = new XElement(XName.Get("title", ExcelCommon.Schema_Chart)); WriteWorkSheetChart_chart_title_tx(title, titleElement); WriteWorkSheetChart_chart_title_layout(title, titleElement); XElement overlayElement = new XElement(XName.Get("overlay", ExcelCommon.Schema_Chart), new XAttribute(XName.Get("val"), title.Overlay ? "1" : "0")); titleElement.Add(overlayElement); WriteWorkSheetChart_chart_title_spPr(title, titleElement); return titleElement; }