0

I am loading a huge document more than 25MB into the FlowDocument. And everything is fine, but it's taking more cpu or long time during initialization to load the entire data into FlowDocument. Instead of that is there a way to load the page dynamically based on the next page click in the bottom of the FlowDocument Control.

Sample code of the Flow Document.

<ScrollViewer HorizontalAlignment="Stretch">
            <GroupBox>
                <GroupBox.Header>
                    <TextBlock Text="Standard Output"></TextBlock>
                </GroupBox.Header>

                <FlowDocument Name="flowDocument" ColumnWidth="999999" Background="Transparent" IsColumnWidthFlexible="True" >

                    <Paragraph Name="para" Background="Transparent" TextAlignment="Justify" KeepTogether="True">
                    </Paragraph>

                </FlowDocument>
            </GroupBox>

        </ScrollViewer>

I am assigning data in the code behind file.

Code to populate the flowdocument in the code behind file.

para.Inlines.Add(ReadDocument());

public void ReadDocument()
{
   textToDisplay = File.ReadAllText(@"C:\sampleLog.txt");
}
realn
  • 1,732
  • 3
  • 12
  • 20
  • What is your question ? – Umair Farooq Aug 29 '16 at 12:58
  • So i am looking for any configuration in flow document or any other control which provides the page loading dynamically based on the next page button click. – realn Aug 29 '16 at 13:15
  • Can't you put a separate button of next/previous outside of FlowDocument and on their click fill required FlowDocument programmatically ? You will just have to write a function to do that. – Umair Farooq Aug 29 '16 at 13:17
  • That's correct, but i am looking for any configuration that wpf provides as flow document already provides paging. Or any other equivalent controls. – realn Aug 29 '16 at 13:19
  • Can you post your code on how you are adding data in FlowDocument ? – Umair Farooq Aug 29 '16 at 13:26
  • Update the question with the code update the FlowDocument. – realn Aug 29 '16 at 13:58
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/122114/discussion-between-realn-and-umair-farooq). – realn Aug 29 '16 at 14:22
  • What is the solution for this? I am also facing same issue. – suyog kotkar Jul 06 '21 at 09:04

0 Answers0