Hello, I have a .NET DataTable containing the data, instead of defining the Table(Aspose.pdf.table) in the code I have defined it in the XML file now I want to bind the rows and columsn of my .NET DataTable to this XML table and to populate my report.
You can do that by following the below mentioned steps:
1. Create a Pdf instance and bind the XML template file to Pdf instance. Please refer to following code:
Pdf pdf1 = new Pdf();
pdf1.BindXML("Template.xml",null);
//Get the section and then table from the obtained section of the Pdf that
//is built from the XML template
Section sec1 = pdf1.Sections["Section1"];
Table table1 = sec1.Paragraphs["Table1"] as Table;
2. Now, use this table and then get the data from the Datatable. Please refer to the following article:
If you need more help please do let us know.
Thanks.
Adeel Ahmad
Support Developer
Aspose Changsha Team
Hello thankx for the reply, dont know what I am doing wrong once again I am describing my self please help me out...thankx
Ok I did a HELLO WORLD example in arabic and wrote some arabic text(إيداعنقديفرع)using a XML file and able to write arabic data successfully based on the configured XML file and C# code. I figured out that I am able to write the arabic text by setting these properties of Segment
FontName="Times New Roman"
FontSize="14"
IsUnicode="true"
IsRightToLeft="true"
Upto here no question.
Now the issue is when I am trying to write the real data which is a .NET DataTable column containing arabic data using C# code I am lost and not able to write the arabic data successfully, can you please provide me some sample code or some example, I tried the example available at your wiki but its not working for me. coz I need to write the dynamic data the example at wiki is good for a static string
My target is to write that arabic text column in the pdf either way using a C# code or by defining and configuring the table in the xml and setting the properties of segment as mentioned above.
1. when you are defining the table in Aspose.Pdf then create a textInfo class object.
2. Set textInfo properties like :
FontName =“Times New Roman”
FontSize=“14”
IsUnicode=“true”
IsRightToLeft="true"
3. Assign table.DefaultCellTextInfo to the object of TextInfo defined in step 2
4. Now, call ImportDatatable containing Arabic text
Hope it works. If it still won’t work then I think it need to change the Arabic unicode text to Ascii string and then save it in Datatable and then call importDatatable method.
Thankx for the reply, I am trying your suggested solution, but I think by it will convert the whole table in unicode format while writing to pdf, my concern is that only the description column should be written in arabic not the whole table, is there a way that we can define only 1 column in a table to written as unicode and set its properties from RIGHTTOLEFT etc...
1. when you are defining the table in Aspose.Pdf then create a textInfo class object.
2. Set textInfo properties like :
FontName ="Times New Roman"
FontSize="14"
IsUnicode="true"
IsRightToLeft="true"
3. Assign table.DefaultCellTextInfo to the object of TextInfo defined in step 2
4. Now, call ImportDatatable containing Arabic text
Hope it works. If it still won't work then I think it need to change the Arabic unicode text to Ascii string and then save it in Datatable and then call importDatatable method.
Thanks.
dear I tried your suggested approach but it did not work... please i am stuck in the middle please help me out..
Thanks dear it workd but instead of using the import table , I am creating a row object of Aspose.pdf.table and then writing and formatting it, which is working fine for the time being, now there is a serious issue., when we are generating a arabic report and trying to save, it is taking 30 seconds to save to the disk where as the english report is being saved on the disk in a flash....
for both arabic and english reports we are using the same Data Access Routines and methods but dont know why this arabic report is taking soo much time....plz need your expertise here....help us...coz due to this issue we cannot go live.....
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.