Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6794673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:15:02+00:00 2026-05-26T18:15:02+00:00

I am trying to create a flowdocument with a Table of data which I

  • 0

I am trying to create a flowdocument with a Table of data which I want to print on the printer. I can create the flowdocument and the printer stuff, but I don’t know how to create the table.

Here is my code:

        //Creating flow document
        Paragraph myParagraph = new Paragraph();

        //Add content to the paragraph
        myParagraph.Inlines.Add(new Bold(new Run("List of tasks (" + TasksToShow.Count + ")")));

        //Create content of paragraph
        DataTable myTable = new DataTable();
        myTable.Columns.Add("Task ID", typeof(int));
        myTable.Columns.Add("Task name", typeof(string));

        foreach (Task task in TasksToShow)
        {
            myTable.Rows.Add(task.TaskID, task.TaskName);
        }

        //Adding content to the flow document
        FlowDocument myFlowDocument = new FlowDocument();
        myFlowDocument.Blocks.Add(myParagraph);
        myFlowDocument.Blocks.Add(myTable);               //This line fails :(

        //Print the document
        PrintDialog dialog = new PrintDialog();
        if(dialog.ShowDialog() == true)
        {
            int margin = 5;
            Size pageSize = new Size(dialog.PrintableAreaWidth - margin * 2, dialog.PrintableAreaHeight - margin * 2);
            IDocumentPaginatorSource paginator = myFlowDocument;
            paginator.DocumentPaginator.PageSize = pageSize;
            dialog.PrintDocument(paginator.DocumentPaginator, "Flow print"); 
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:15:02+00:00Added an answer on May 26, 2026 at 6:15 pm

    you can do like this…..

    // Create the parent FlowDocument...
    flowDoc = new FlowDocument();
    
    // Create the Table...
    table1 = new Table();
    // ...and add it to the FlowDocument Blocks collection.
    flowDoc.Blocks.Add(table1);
    
    
    // Set some global formatting properties for the table.
    table1.CellSpacing = 10;
    table1.Background = Brushes.White;
    

    pls go through this links for more info

    after that you can change this depnds upon the your requirement…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying create a new file with a Java Applet, but I don't know
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I'm trying create a RCP Application with Eclipse, but I can't get past the
I am trying create a data.frame from which to create a graph. I have
I am trying create system in which I can login from php and then
Ok so I am trying create a login script, here I am using PHP5
Trying to create a user account in a test. But getting a Object reference
Trying to create a list to return some JSON data to a view. Following
I'm trying create a ASMX webservice that can perform a HTTP GET request. I
I'm trying to write a table trigger which queries another table that is outside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.