Exemple #1
0
        public void Write(XElement parent)
        {
            XNamespace ns = parent.Name.Namespace;

            XElement abstractNum = new XElement(
                ns + "abstractNum",
                new XAttribute(ns + "abstractNumId", _id));

            parent.Add(abstractNum);

            XElement multi = new XElement(
                ns + "multiLevelType",
                new XAttribute(ns + "val", "multiLevel"));

            abstractNum.Add(multi);

            XElement lvl = new XElement(
                ns + "lvl",
                new XAttribute(ns + "ilvl", _level));

            //	We use level zero to mean "no indent" (that is, not a list
            //	at all) but Word starts numbering levels at zero, so we
            //	subtract one here
            abstractNum.Add(lvl);

            string   formatName = GetNumFmt(_style.NumberStyle);
            XElement numFmt     = new XElement(
                ns + "numFmt",
                new XAttribute(ns + "val", formatName));

            lvl.Add(numFmt);

            XElement lvlText = new XElement(
                ns + "lvlText",
                new XAttribute(ns + "val", _text));

            lvl.Add(lvlText);

            XElement rPr = StyleHelpers.AddRunProperties(lvl, _style.Font, _style.Color);

            //TODO: tabs?
        }
Exemple #2
0
        public void Write(XElement paragraph)
        {
            XNamespace ns = paragraph.Name.Namespace;

            XElement run = new XElement(ns + "r");

            paragraph.Add(run);

            //	Style properties in Word can be inherited in the style
            //	hierarchy, but our layouts have already collapsed the
            //	hierarchy into a single description, and so we don't
            //	need worry about inheritance in Word.

            XElement props = StyleHelpers.AddRunProperties(run, _font, _color);

            XElement text = new XElement(
                ns + "t",
                new XAttribute(XNamespace.Xml + "space", "preserve"));

            text.Value = _text;
            run.Add(text);
        }