MS Word Doc. Performance

Posted by Vikie4u under ASP.NET on 10/16/2008 | Views : 1463 | Status : [Member] | Replies : 4
Hi All,

There is a word doc in my C# application which is created using the code in the project.In the doc there is a table in which the data is populated from the DB.The data is populated in a way such that it is taking value from each row and each column from the table(of the DB) and putting in each cell in the table(in word doc).Suppose if the table has some 1000 rows and 5 columns than than it will go to each row and column to put data in Word doc.That is why it is taking lots of time to open the word Document and it is very annoying for the user.

Is there any way to reduce the time and populate the data in the Word Doc in form of table ? Please help me regarding this.

Thanks and Regards,

Vikram




Responses

Posted by: Raja on: 10/16/2008 [Member] Starter

Up
0
Down
Are you writing into the Ms Word document one row each time? Not sure if you are doing this.

I think you can prepare your whole html based on the data coming from database and then write the HTML into the Ms Word document. Just see this article.

http://www.dotnetfunda.com/articles/article9.aspx



Regards,
Raja, USA

Vikie4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikie4u on: 10/17/2008 [Member] Starter

Up
0
Down
Thank you Sir...The performance is much better.But
as the data will be large in DB so while populating data in the word doc ,it is coming in a single page but it should got to next page as one page is filled with data,how can I insert page break in that.

Vikie4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raja on: 10/17/2008 [Member] Starter

Up
0
Down
You can add following line after specific number of record.

<br clear="all" style="page-break-before:always" /> and it should break the page and next line page start writing your rows again.

You will have to do some trial and error and find out.

Regards,
Raja, USA

Vikie4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikie4u on: 10/22/2008 [Member] Starter

Up
0
Down
Hi Raja,


Is there any way to convert HTML to Word in .NET,having the same look when Acrobat converts HTML.


Thanks,
Vikram

Vikie4u, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response