{I+=codeWee;}
[C#] OpenXML: Convert Microsoft Word File to HTML File
// download and install "OpenXML SDK 2.5": http://www.microsoft.com/en-us/download/details.aspx?id=30425
// download, unzip and build "PowerTools for Open XML": http://powertools.codeplex.com/
// add reference: DocumentFormat.OpenXML, Windows.Base, OpenXmlPowerTools
//

..
using DocumentFormat.OpenXml.Office2013.Word;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using OpenXmlPowerTools;
using System.Xml.Linq;
..



	byte[] byteArray = File.ReadAllBytes(@"e:\a.docx");
	using (MemoryStream memoryStream = new MemoryStream())
	{
		memoryStream.Write(byteArray, 0, byteArray.Length);
		using (WordprocessingDocument doc =
			WordprocessingDocument.Open(memoryStream, true))
		{
			HtmlConverterSettings settings = new HtmlConverterSettings()
			{
				PageTitle = "My Page Title"
			};
			XElement html = HtmlConverter.ConvertToHtml(doc, settings);

			File.WriteAllText(@"e:\Test.html", html.ToStringNewLineOnAttributes());
		}
	}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.