문제

I have a WPF Window that I want to save to an XPS file (or really, any type of file that would store the window image). This window contains a lengthy DataGrid. So far I am able to write to an XPS file, but the resulting document contains only one page, so most of the DataGrid rows are missing. How can I get the XPSDocumentWriter to use as many pages as necessary?

Here is what I've got so far (I've turned off the grid scroll bar and autosized the window to make sure it is full-sized before writing to XPS file):

Dim visual = CType(Me.Content, Media.Visual)

            Me.LogGrid.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden
            Me.SizeToContent = Windows.SizeToContent.WidthAndHeight

            Dim xd As New System.Windows.Xps.Packaging.XpsDocument(file, IO.FileAccess.ReadWrite)

            Dim xw = System.Windows.Xps.Packaging.XpsDocument.CreateXpsDocumentWriter(xd)
            xw.Write(visual)
            xd.Close()
도움이 되었습니까?

해결책

I think Will's comment is probably the right answer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top