0

I have kind of reports about students accounts is it possible to print it into the default physical printer or software printer like BioPDF printer and how to format my text in C#.

I am using WPF writing my Code using C#. and I am sorry because I don't have any idea what kind of information to provide in this question just be patient ;).

//===================EDIT===========================

PrintDialog printDialog = new PrintDialog();
       if (printDialog.ShowDialog().GetValueOrDefault(false))
       {
           printDialog.PrintVisual(listBox1, this.Title);
       }

// I am trying to print a content of ListBox, but the problem is that I am using Arabic language in my visual

<ListView HorizontalAlignment="Left" Margin="503,73,0,98" Name="listBoxEPayed" Width="410" MouseDoubleClick="listBoxEPayed_MouseDoubleClick">
            <ListView.View>
                <GridView>
                    <GridView.Columns>
                        <GridViewColumn Header="الرقم" Width="50" DisplayMemberBinding="{Binding Path=ReportID}" />
                        <GridViewColumn Header="محرر الفاتوره" Width="100" DisplayMemberBinding="{Binding Path=UserName}" />
                        <GridViewColumn Header="قيمة المبلغ" Width="75" DisplayMemberBinding="{Binding Path=Cashamount}" />
                        <GridViewColumn Header="التاريخ" Width="120" DisplayMemberBinding="{Binding Path=Date}" />
                    </GridView.Columns>
                </GridView>
            </ListView.View>
        </ListView>

//the result of printing is all character is upset down. Note that I am Testing the layout of the printed pages using bioPDF printer software. the result is seems like in this picenter image description here

Yasser
  • 1,725
  • 4
  • 22
  • 28

1 Answers1

1

Option 1: Use a WPF form to print out. The following code snippet is from SO question ( Printing of WPF Window on one page )

PrintDialog printDialog = new PrintDialog();
if (printDialog.ShowDialog().GetValueOrDefault(false))
{
    printDialog.PrintVisual(this, this.Title); 
}

The problem with that is, the windows might well not fit onto one sheet of paper.


Option 2: Bind your data to a reporting solution like Chrystal Reports ( now owned by SAP, there is a free version available ), Active Reports, DevExpress or one of the others. Some of the available reporting components are pretty expensive, but for high quality results their worth the money.

Community
  • 1
  • 1
Sascha
  • 10,231
  • 4
  • 41
  • 65
  • I see that print is something not easy to obtain, What about form a document and save it as a text or docx or even pdf can you help me with that? – Yasser Jun 20 '12 at 07:04
  • Thank you very much, I am trying to solve my problem. Would you please see my Edit – Yasser Jun 20 '12 at 07:28
  • According to http://social.msdn.microsoft.com/Forums/en/wpf/thread/e7bb5adc-8811-4ce5-903d-af578e8fae1e this happens with some printers. Can you try on a "real" printer or one of the alternatives mentioned there? – Sascha Jun 20 '12 at 08:02
  • sorry to late but I was facing some problem with my printer. I've try to print on a real printer its name "HP LaserJet 6l" it's an old one is it make a problem? – Yasser Jun 21 '12 at 12:22
  • any way I am using another solution now. The solution is to open up a new window and put in it just my listview and print the whole window ;), it's working – Yasser Jun 21 '12 at 12:24