- Code: Select all
Document document = new Document(@"C:\test6\轉檔.doc");
var resultDoc = new Document();
var newSection = resultDoc.AddSection();
//只抓section0- table0 - row0- cell0 中的所有內容
var section = document.Sections[0];
var table = section.Tables[0];
var row = table.Rows[0];
var cell = row.Cells[0];
var documentObjects = cell.ChildObjects; //以paragraph去切分,which is splited by 換行符號
foreach (var documentObj in documentObjects)
{
var paragraph = documentObj as Paragraph;
if (paragraph == null) continue;
//clone
newSection.Paragraphs.Add(paragraph.Clone() as Paragraph);
}
resultDoc.SaveToFile(@"C:\test6\轉檔後,「答案」兩個字的字型變小了.docx", FileFormat.Docx);
附檔 已寄到:support@e-iceblue.com
轉檔.doc copy 到 轉檔後,「答案」兩個字的字型變小了 .docx 答案字體變小了