Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3842408
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:47:21+00:00 2026-05-19T15:47:21+00:00

I have created an xml document and an xslt document and now i want

  • 0

I have created an xml document and an xslt document and now i want to create a word doc/rtf using these through using c#.

I have found the following code on the internet however I can’t find a way to use it because I’m not using datasets. I just want the program to read the xml and the xslt combine the two and create a word document

Any help would be really appreciated

DataSet ds;

    XmlDataDocument xmlDoc;

    XslCompiledTransform xslTran;

    XmlElement root;

    XPathNavigator nav;

    XmlTextWriter writer;

    try

    {

        //Create the DataSet from the XML file

        ds = new DataSet();

        ds.ReadXml("Employee.xml");

        //Create the XML from the DataSet

        xmlDoc = new XmlDataDocument(ds);

        //Load the XSLT for Transformation

        xslTran = new XslCompiledTransform();

        xslTran.Load("Employee.xslt");

        //Determine the Root object in the XML

        root = xmlDoc.DocumentElement;

        //Create the XPath Navigator to navigate throuth the XML

        nav = root.CreateNavigator();

        //First delete the RTF, if already exist

        if (File.Exists("Employee.rtf"))

       {

            File.Delete("Employee.rtf");

       }

        //Create the RTF by Transforming the XML and XSLT

        writer = new XmlTextWriter("Employee.rtf", System.Text.Encoding.Default);

        xslTran.Transform(nav, writer);

        //Close the Writer after Transformation

        writer.Close();

        //Release all objects

        writer = null;

        nav = null;

        root = null;

        xmlDoc = null;

        ds = null;

        MessageBox.Show("Document created successfully.....");

    }

    catch (Exception ex)

    {

        writer = null;

        nav = null;

        root = null;

        xmlDoc = null;

        ds = null;

        MessageBox.Show(ex.StackTrace);

    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:47:22+00:00Added an answer on May 19, 2026 at 3:47 pm

    Read http://msdn.microsoft.com/en-us/library/0610k0w4.aspx, it tells you how to use XslCompiledTransform. If you want to transform from a file and output a file then all you need is

    XslCompiledTransform proc = new XslCompiledTransform();
    proc.Load("stylesheet.xslt");
    proc.Transform("input.xml", "output.rtf");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using WiX (Windows Installer XML) I have created an MSI installer which installs Word
I'm using PHP5 to create XML files. I have code like this: $doc =
I have created a xslt document which formats an xml document, but I would
I have an expression tree I have created by parsing an Xml using the
I am using XSLT to convert a very large XML document into (X)HTML. For
I have an XML document and made an XSLT to output is as HTML
I have an XSLT transform I am using to process an XML file, inserting
I want to create an XML document from object list. How to handle Null
I have a XmlDocument in java, created with the Weblogic XmlDocument parser. I want
I have a database in ISO-8859-2 format, but I need to create XML in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.