2014-01-13 99 views

回答

1

您必須抓取FlowDocument的每個節點,然後最終將其內容轉換爲相應的段落,如DocX庫的InsertAfter方法。

我試過使用DocX,但將它從WPF轉換爲Word並不容易。我們結束了使用RTFWord使其正常佈局,而不必處理與它實際上看起來像WPF和Word

樣品

Table currentTable = CreateDocXTable(table.Columns.Count, table.RowGroups[0].Rows.Count); 
if(block is Section) 
{ 
var editableSection = block as Section; 
var content = new TextRange(editableSection.ContentStart, editableSection.ContentEnd); 
currentTable.Rows[rowIndex].Cells[cellIndex].Paragraphs[0].InsertText(content.Text); 
} 
佈局