private void WriteContents(int id, DrawPosition from, DrawPosition to) { var shape = data.Add("sp"); shape["macro"] = ""; shape["textlink"] = ""; // non visual shape properties var nonVisualProperties = shape.Add("nvSpPr"); var drawingProperties = nonVisualProperties.Add("cNvPr"); drawingProperties.SetAttributeValue("id", id); drawingProperties["name"] = "TextBox " + id; nonVisualProperties.Add("cNvSpPr")["txBox"] = "1"; // shape properties var shapePropertiesData = shape.Add("spPr"); ShapeProperties = ShapeProperties.New(shapePropertiesData, from, to); // style var style = shape.Add("style"); var lineReference = style.Add("a", "lnRef"); lineReference["idx"] = "0"; RgbColorModel.SetPercentageColor(lineReference, 0, 0, 0); var fillReference = style.Add("a", "fillRef"); fillReference["idx"] = "0"; RgbColorModel.SetPercentageColor(fillReference, 0, 0, 0); var effectReference = style.Add("a", "effectRef"); effectReference["idx"] = "0"; RgbColorModel.SetPercentageColor(effectReference, 0, 0, 0); var fontReference = style.Add("a", "fontRef"); fontReference["idx"] = "minor"; fontReference.Add("schemeClr")["val"] = "dk1"; // text body var textBody = shape.Add("txBody"); textBody.Add("a", "bodyPr").SetAttributeValues("vertOverflow=clip horzOverflow=clip vert=horz lIns=63500 tIns=25400 rIns=63500 rtlCol=0 anchor=t"); textBody.Add("a", "lstStyle"); var run = textBody.Add("a", "p").Add("r"); var runProperties = run.Add("rPr"); runProperties.SetAttributeValues("lang=en-US sz=1000"); RgbColorModel.SetHexColor(runProperties.Add("solidFill"), 0, 0, 0); runProperties.Add("latin")["typeface"] = "Arial"; run.Add("t").Value = ""; data.Add("clientData"); }
private Shape(XElementData data, Drawings drawings) { this.data = data; this.drawings = drawings; ShapeProperties = null; // shape properties for existing shapes will not be initialized }