5
如何讓FixedDocument自動分頁?我可以使用下面的代碼將美化面板放入DocViewer中。當面板延伸到單個頁面時會出現問題。現在,我們簡單地剪輯。基本上,我想創建一個相當通用的方式來打印用戶正在查看的內容。我的方法合理嗎?WPF固定文檔分頁
public void CreateReport(Panel details)
{
FixedDocument fixedDoc = new FixedDocument();
PageContent pageContent = new PageContent();
FixedPage fixedPage = new FixedPage();
fixedPage.DataContext = this.DataContext;
fixedPage.Margin = new Thickness(10);
fixedPage.Children.Add(details);
((System.Windows.Markup.IAddChild)pageContent).AddChild(fixedPage);
fixedDoc.Pages.Add(pageContent);
// This makes the array of controls invisibile, then climbs the details structure
// and makes the controls within details appropriate for the DocumentViewwer (i.e. TextBoxes are
// non-editable, no borders, no scroll bars, etc).
prePrintPrepare(details, fixedPage, new FrameworkElement[] { controlToMakeInvisible });
_dv = new DocViewer();
_dv.documentViewer1.Document = fixedDoc;
_dv.Show();
}
這是偉大的!我想知道是否有可能在項目之間做一個分頁,而不是切入某些東西。 – BoomBaby 2018-02-21 03:20:32