Exemple #1
0
        /// <summary>
        /// Creates the paragraph properties.
        /// </summary>
        /// <param name="style">The style.</param>
        /// <param name="propertyNode">The property node.</param>
        /// <returns></returns>
        private ParagraphProperties CreateParagraphProperties(IStyle style, XmlNode propertyNode)
        {
            ParagraphProperties paragraphProperties = new ParagraphProperties(style);

            paragraphProperties.Node = propertyNode;
            TabStopStyleCollection tabCollection = new TabStopStyleCollection(this._document);

            if (propertyNode.HasChildNodes)
            {
                foreach (XmlNode node in propertyNode.ChildNodes)
                {
                    if (node.Name == "style:tab-stops")
                    {
                        foreach (XmlNode nodeTab in node.ChildNodes)
                        {
                            if (nodeTab.Name == "style:tab-stop")
                            {
                                tabCollection.Add(this.CreateTabStopStyle(nodeTab));
                            }
                        }
                    }
                }
            }

            if (tabCollection.Count > 0)
            {
                paragraphProperties.TabStopStyleCollection = tabCollection;
            }

            return(paragraphProperties);
        }
Exemple #2
0
        public void TabstopTest()
        {
            //Create new document
            TextDocument document = new TextDocument();

            document.New();
            //Create new paragraph
            Paragraph par = new Paragraph(document, "P1");
            //Create a new TabStopStyle collection
            TabStopStyleCollection tsc = new TabStopStyleCollection(document);
            //Create TabStopStyles
            TabStopStyle ts = new TabStopStyle(document, 4.98);

            ts.LeaderStyle = TabStopLeaderStyles.Dotted;
            ts.LeaderText  = ".";
            ts.Type        = TabStopTypes.Center;
            //Add the tabstop
            tsc.Add(ts);
            //Append the TabStopStyleCollection
            ((ParagraphStyle)par.Style).Properties.TabStopStyleCollection = tsc;
            //Add some text, use @ qualifier when ever you use control chars!
            string     mytebstoptext = @"Hello\tHello again";
            SimpleText stext         = new SimpleText(par, mytebstoptext);

            //the simple text
            par.TextContent.Add(stext);
            //Add the paragraph to the content container
            document.Content.Add(par);
            //Save
            document.SaveTo("tabstop.odt");
        }
        /// <summary>
        /// Creates the paragraph properties.
        /// </summary>
        /// <param name="style">The style.</param>
        /// <param name="propertyNode">The property node.</param>
        /// <returns></returns>
        private ParagraphProperties CreateParagraphProperties(IStyle style, XElement propertyNode)
        {
            ParagraphProperties paragraphProperties = new ParagraphProperties(style)
            {
                Node = propertyNode
            };
            TabStopStyleCollection tabCollection = new TabStopStyleCollection(_document);

            if (propertyNode.HasElements)
            {
                foreach (XElement node in propertyNode.Elements())
                {
                    if (node.Name == Ns.Style + "tab-stops")
                    {
                        foreach (XElement nodeTab in node.Elements())
                        {
                            if (nodeTab.Name == Ns.Style + "tab-stop")
                            {
                                tabCollection.Add(CreateTabStopStyle(nodeTab));
                            }
                        }
                    }
                }
            }

            if (tabCollection.Count > 0)
            {
                paragraphProperties.TabStopStyleCollection = tabCollection;
            }

            return(paragraphProperties);
        }
Exemple #4
0
        /// <summary>
        /// Gets the tab stop style.
        /// </summary>
        /// <param name="leaderStyle">The leader style.</param>
        /// <param name="leadingChar">The leading char.</param>
        /// <param name="position">The position.</param>
        /// <returns>A for a table of contents optimized TabStopStyleCollection</returns>
        public TabStopStyleCollection GetTabStopStyle(string leaderStyle, string leadingChar, double position)
        {
            TabStopStyleCollection tabStopStyleCol = new TabStopStyleCollection(((TextDocument)this.Document));
            //Create TabStopStyles
            TabStopStyle tabStopStyle = new TabStopStyle(((TextDocument)this.Document), position);

            tabStopStyle.LeaderStyle = leaderStyle;
            tabStopStyle.LeaderText  = leadingChar;
            tabStopStyle.Type        = TabStopTypes.Center;
            //Add the tabstop
            tabStopStyleCol.Add(tabStopStyle);

            return(tabStopStyleCol);
        }
Exemple #5
0
        /// <summary>
        /// Gets the tab stop style.
        /// </summary>
        /// <param name="leaderStyle">The leader style.</param>
        /// <param name="leadingChar">The leading char.</param>
        /// <param name="position">The position.</param>
        /// <returns>A for a table of contents optimized TabStopStyleCollection</returns>
        public TabStopStyleCollection GetTabStopStyle(string leaderStyle, string leadingChar, double position)
        {
            TabStopStyleCollection tabStopStyleCol = new TabStopStyleCollection(Document);
            //Create TabStopStyles
            TabStopStyle tabStopStyle = new TabStopStyle(Document, position)
            {
                LeaderStyle = leaderStyle,
                LeaderText  = leadingChar,
                Type        = TabStopTypes.Center
            };

            //Add the tabstop
            tabStopStyleCol.Add(tabStopStyle);

            return(tabStopStyleCol);
        }
Exemple #6
0
		public void TabstopTest()
		{
			//Create new document
			TextDocument document		= new TextDocument();
			document.New();
			//Create new paragraph
			Paragraph par				= new Paragraph(document, "P1");
			//Create a new TabStopStyle collection
			TabStopStyleCollection tsc	= new TabStopStyleCollection(document);
			//Create TabStopStyles
			TabStopStyle ts				= new TabStopStyle(document, 4.98);
			ts.LeaderStyle				= TabStopLeaderStyles.Dotted;
			ts.LeaderText				= ".";
			ts.Type						= TabStopTypes.Center;
			//Add the tabstop
			tsc.Add(ts);
			//Append the TabStopStyleCollection
			((ParagraphStyle)par.Style).Properties.TabStopStyleCollection = tsc;
			//Add some text, use @ qualifier when ever you use control chars!
			string mytebstoptext		= @"Hello\tHello again";
			SimpleText stext			= new SimpleText(par, mytebstoptext);
			//the simple text
			par.TextContent.Add(stext);
			//Add the paragraph to the content container
			document.Content.Add(par);
			//Save
			document.SaveTo("tabstop.odt");
		}