Example #1
0
        /// <summary>
        /// Creates the formated text.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        public FormatedText CreateFormatedText(IDocument document, XmlNode node)
        {
            try
            {
                //Create a new FormatedText object
                FormatedText    formatedText = new FormatedText(document, node);
                ITextCollection iTextColl    = new ITextCollection();
                formatedText.Document = document;
                formatedText.Node     = node;
                //Recieve a TextStyle

                IStyle textStyle = document.Styles.GetStyleByName(formatedText.StyleName);

                if (textStyle != null)
                {
                    formatedText.Style = textStyle;
                }
                else
                {
                    IStyle iStyle = document.CommonStyles.GetStyleByName(formatedText.StyleName);
                    if (iStyle == null)
                    {
                        if (OnWarning != null)
                        {
                            AODLWarning warning = new AODLWarning("A TextStyle for the FormatedText object wasn't found.");
                            warning.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                            warning.Node     = node;
                            OnWarning(warning);
                        }
                    }
                }

                //Ceck for more IText object
                foreach (XmlNode iTextNode in node.ChildNodes)
                {
                    IText iText = this.CreateTextObject(document, iTextNode.CloneNode(true));
                    if (iText != null)
                    {
                        iTextColl.Add(iText);
                    }
                    else
                    {
                        iTextColl.Add(new UnknownTextContent(document, iTextNode) as IText);
                    }
                }

                formatedText.Node.InnerText = "";

                foreach (IText iText in iTextColl)
                {
                    formatedText.TextContent.Add(iText);
                }

                return(formatedText);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #2
0
        /// <summary>
        /// Creates the X link.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        public XLink CreateXLink(IDocument document, XElement node)
        {
            try
            {
                XLink xlink = new XLink(document)
                {
                    Node = new XElement(node)
                };
                ITextCollection iTxtCol = new ITextCollection();

                foreach (XNode nodeText in xlink.Node.Nodes())
                {
                    IText iText = CreateTextObject(xlink.Document, nodeText);
                    if (iText != null)
                    {
                        iTxtCol.Add(iText);
                    }
                }

                xlink.Node.Value = "";

                foreach (IText iText in iTxtCol)
                {
                    xlink.TextContent.Add(iText);
                }

                return(xlink);
            }
            catch (Exception ex)
            {
                throw new AODLException("Exception while trying to create a XLink.", ex);
            }
        }
Example #3
0
        /// <summary>
        /// Creates the X link.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        public XLink CreateXLink(IDocument document, XmlNode node)
        {
            try
            {
                XLink xlink = new XLink(document);
                xlink.Node = node.CloneNode(true);
                ITextCollection iTxtCol = new ITextCollection();

                foreach (XmlNode nodeText in xlink.Node.ChildNodes)
                {
                    IText iText = this.CreateTextObject(xlink.Document, nodeText);
                    if (iText != null)
                    {
                        iTxtCol.Add(iText);
                    }
                }

                xlink.Node.InnerXml = "";

                foreach (IText iText in iTxtCol)
                {
                    xlink.TextContent.Add(iText);
                }

                return(xlink);
            }
            catch (Exception ex)
            {
                throw new AODLException("Exception while trying to create a XLink.", ex);
            }
        }
Example #4
0
        /// <summary>
        /// Creates the formated text.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        public FormatedText CreateFormatedText(IDocument document, XElement node)
        {
            //Create a new FormatedText object
            FormatedText    formatedText = new FormatedText(document, node);
            ITextCollection iTextColl    = new ITextCollection();

            formatedText.Document = document;
            formatedText.Node     = node;
            //Recieve a TextStyle

            IStyle textStyle = document.Styles.GetStyleByName(formatedText.StyleName);

            if (textStyle != null)
            {
                formatedText.Style = textStyle;
            }
            //else
            //{
            //	IStyle iStyle				= document.CommonStyles.GetStyleByName(formatedText.StyleName);
            //}

            //Ceck for more IText object
            foreach (XNode iTextNode in node.Nodes())
            {
                XNode clone = iTextNode is XElement
                                  ? (XNode) new XElement((XElement)iTextNode)
                                  : new XText((XText)iTextNode);
                IText iText = CreateTextObject(document, clone);
                if (iText != null)
                {
                    iTextColl.Add(iText);
                }
                else
                {
                    iTextColl.Add(new UnknownTextContent(document, (XElement)iTextNode));
                }
            }

            formatedText.Node.Value = "";

            foreach (IText iText in iTextColl)
            {
                formatedText.TextContent.Add(iText);
            }

            return(formatedText);
        }
Example #5
0
        /// <summary>
        /// Creates the formated text.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        public FormatedText CreateFormatedText(IDocument document, XmlNode node)
        {
            //Create a new FormatedText object
            FormatedText    formatedText = new FormatedText(document, node);
            ITextCollection iTextColl    = new ITextCollection();

            formatedText.Document = document;
            formatedText.Node     = node;
            //Recieve a TextStyle

            IStyle textStyle = document.Styles.GetStyleByName(formatedText.StyleName);

            if (textStyle != null)
            {
                formatedText.Style = textStyle;
            }
            //else
            //{
            //	IStyle iStyle				= document.CommonStyles.GetStyleByName(formatedText.StyleName);
            //}

            //Ceck for more IText object
            foreach (XmlNode iTextNode in node.ChildNodes)
            {
                IText iText = this.CreateTextObject(document, iTextNode.CloneNode(true));
                if (iText != null)
                {
                    iTextColl.Add(iText);
                }
                else
                {
                    iTextColl.Add(new UnknownTextContent(document, iTextNode) as IText);
                }
            }

            formatedText.Node.InnerText = "";

            foreach (IText iText in iTextColl)
            {
                formatedText.TextContent.Add(iText);
            }

            return(formatedText);
        }
Example #6
0
        /// <summary>
        /// Creates the X link.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        public XLink CreateXLink(IDocument document, XmlNode node)
        {
            try
            {
                XLink xlink = new XLink(document);
                xlink.Node = node.CloneNode(true);
                ITextCollection iTxtCol = new ITextCollection();

                foreach (XmlNode nodeText in xlink.Node.ChildNodes)
                {
                    IText iText = this.CreateTextObject(xlink.Document, nodeText);
                    if (iText != null)
                    {
                        iTxtCol.Add(iText);
                    }
                }

                xlink.Node.InnerXml = "";

                foreach (IText iText in iTxtCol)
                {
                    xlink.TextContent.Add(iText);
                }

                return(xlink);
            }
            catch (Exception ex)
            {
                AODLException exception = new AODLException("Exception while trying to create a XLink.");
                exception.InMethod          = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                exception.Node              = node;
                exception.OriginalException = ex;

                throw exception;
            }
        }