Exemplo n.º 1
0
        /// <summary>
        /// Initiates translation from XML to RTF (Rich Text Format)
        /// Returns an object representing a RTF document.
        /// </summary>
        /// <returns></returns>
        public NuGenRtfDocument ToRtfDocument()
        {
            this.rtfDocument = new NuGenRtfDocument();

            // Starting at the placeholding element XmlTranslator_root,
            // the primary translation method is called recursively on all
            // of the nodes in the XML DOM.
            try
            {
                foreach (XmlNode child in this.DocumentElement.ChildNodes)
                {
                    this.rtfDocument.AppendText("{\\pard ");
                    TranslateXmlNodeIntoRtfGroup(child, 3);
                    this.rtfDocument.AppendText("}");
                }
            }
            catch (Exception e)
            {
                // Catch any other exceptions during translation.
                errors.Add("Error during translation. " + e.Message);
            }

            return(this.rtfDocument);
        }
Exemplo n.º 2
0
		/// <summary>
		/// Initiates translation from XML to RTF (Rich Text Format)
		/// Returns an object representing a RTF document.
		/// </summary>
		/// <returns></returns>
		public NuGenRtfDocument ToRtfDocument()
		{
			this.rtfDocument = new NuGenRtfDocument();
			
			// Starting at the placeholding element XmlTranslator_root,
			// the primary translation method is called recursively on all
			// of the nodes in the XML DOM.
			try
			{
				foreach (XmlNode child in this.DocumentElement.ChildNodes)
				{
					this.rtfDocument.AppendText("{\\pard ");
					TranslateXmlNodeIntoRtfGroup(child, 3);
					this.rtfDocument.AppendText("}");
				}
			}
			catch (Exception e)
			{
				// Catch any other exceptions during translation.
				errors.Add("Error during translation. " + e.Message);
			}

			return this.rtfDocument;
		}