Hi ,
I have project that i have read content control by tag name then convert its content to HTML including images and tables that has merged cells.
Does the Spire.Doc provide functionality to do this?
Thanks,
Sam
Document doc = new Document(FilePath + @"19264.docx");
//create a new file for adding content of control
Document NewDoc = new Document();
Section sec = NewDoc.AddSection();
foreach (Section section in doc.Sections)
{
foreach (Body body in section.ChildObjects)
{
foreach (DocumentObject bodyObj in body.ChildObjects)
{
if (bodyObj is StructureDocumentTag)
{
IStructureDocument sdt = bodyObj as IStructureDocument;
//get the sdt by name
if (sdt.SDTProperties.Tag == "Textbox")
{
foreach (DocumentObject SObj in sdt.ChildObjects)
{
//add the content
sec.Body.ChildObjects.Add(SObj.Clone());
}
}
}
}
}
}
NewDoc.SaveToFile("19264.html", FileFormat.Html);