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 void WriteContents(DrawPosition from, DrawPosition to)
        {
            // transform
            //var transform = data.Add("a", "xfrm");
            //var offset = transform.Add("off");
            //offset.SetAttributeValue("x", from.X); // absolute coordinate
            //offset.SetAttributeValue("y", from.Y); // absolute coordinate
            //var extension = transform.Add("ext");
            //extension.SetAttributeValue("cx", to.X - from.X); // absolute width
            //extension.SetAttributeValue("cy", to.Y - from.Y); // absolute height
            // preset geometry
            var presetGeometry = data.Add("a", "prstGeom");

            presetGeometry["prst"] = "rect";
            presetGeometry.Add("avLst");
            // solid fill
            RgbColorModel.SetHexColor(data.Add("a", "solidFill"), 255, 255, 255);//TODO: set color
            // outline
            var outline = data.Add("a", "ln");

            outline["w"]    = "9525"; // line width
            outline["cmpd"] = "sng";  // compound type (default: sng)
            RgbColorModel.SetHexColor(outline.Add("solidFill"), 0, 0, 0);
        }
 public void SetSolidFill(int r, int g, int b)
 {
     RgbColorModel.SetHexColor(data.Element("a", "solidFill"), r, g, b);
 }