Hi,
Sorry that I'm not clear about your question. What do you mean by "display this as HTML"? Do you want to display the content with the tags or just keep the formats?
Also, could you please tell me your user scenario? are you generating the documents from template with HTML chunk? Where do you get the HTML chunk? How will the final documents be used typically? for print, send, view...? Do you need to convert the documents to other file formats, pdf, odf...? Are you using some other technologies, database, sharepoint, silverlight...?
I want to understand how the users use the SDK and what solutions are built upon it, thanks:)
Shuangshuang (MS)
Hi
You can use this code
///
using (Stream chunkStream = chunk.GetStream(FileMode.Create, FileAccess.Write))using (StreamWriter stringStream = new StreamWriter(chunkStream))stringStream.Write(html);
string altChunktemplate = String.Format("<w:altChunk r:id=\"{0}\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" />", altChunkId);
XmlDocumentFragment oDocFrag = mainDocument.CreateDocumentFragment();oDocFrag.InnerXml = altChunktemplate;
if (oNode.InnerXml.IndexOf("w:tc") > 0){XmlNode tcNode = oNode.SelectSingleNode("w:tc//w:p", mainNamespaceMrg);if (tcNode != null){oDocFrag.InnerXml = oDocFrag.InnerXml + "<w:p xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"><w:r xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"><w:t xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"></w:t></w:r></w:p>";tcNode.ParentNode.InsertAfter(oDocFrag, tcNode);}}elseoNode.ParentNode.InsertAfter(oDocFrag, oNode);}}