A recently written Method for exporting Word via XML. For details, refer:
Method call:
Dictionary <string, string> wordTexts = new Dictionary <string, string> ();
Dictionary <string, DataTable> wordTable = new Dictionary <string, DataTable> ();
WordMLHelper Word = new WordMLHelper ();
WordTexts. Clear ();
WordTexts. Add ("bookmark name in XML", "exported content ");
Word. SetNodeText (wordTexts );
DataTable dt = getDateTable (); // obtain a data table
WordTable. Clear ();
WordTable. Add ("bookmark name in XML", dt );
Word. SetNodeTable (wordTable );
Word. Save ("storage address ");
The operation code is as follows:
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Using System. Xml;
Using System. Drawing;
Using System. IO;
Using System. Data;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Collections;
Using System. Web;
/// <Summary>
/// Export the word
/// Author: FreezeSoul & Worm
/// Operation WordML (2003) insert text, tables, and images based on tags
/// </Summary>
Public class WordMLHelper
{
/// <Summary>
/// The width of the shortest path image in the exported Word file
/// Add a node to webconfig <add key = "WordWidth" value = "400"/>
/// </Summary>
Public string WordWidth
{
Get
{
Return System. Configuration. ConfigurationSettings. receivettings ["WordWidth"]. ToString ();
}
}
/// <Summary>
/// Shortest Path height of the image in the exported Word file
/// Add a node to webconfig <add key = "WordHeight" value = "300"/>
/// </Summary>
Public