Generating ms word document in .net

N

Noor

Hi all,

I need to well formatted ms word document through vb.net.

All the data that will make the word document will come from the database.
and formatted dynamically.

Currently i have started doing it in crystal report and finally i will
export that crystal report to ms word format.

but i feel it's not a better way to do it.

Can anyone give me a good idea.. how can i generate dynamic well formatted
documents.

Actually the documents i will generate are already exists and well formatted
but my client want me to
generate the same document dynamically.

regards,

Nor
 
C

chris

Noor said:
Hi all,

I need to well formatted ms word document through vb.net.

All the data that will make the word document will come from the database.
and formatted dynamically.

Currently i have started doing it in crystal report and finally i will
export that crystal report to ms word format.

but i feel it's not a better way to do it.

Can anyone give me a good idea.. how can i generate dynamic well formatted
documents.

Actually the documents i will generate are already exists and well formatted
but my client want me to
generate the same document dynamically.

regards,

Nor


Hello -

If you can live w/o Word and use PDF instead, check out:

http://itextsharp.sourceforge.net/
http://www.ujihara.jp/iTextdotNET/

Which are ports of the iText Java PDF Library which I have used and can
confirm — kicks ass!


I think they both offer limited RTF support as well. Good luck.
 
S

scorpion53061

I need to well formatted ms word document through vb.net.
Hi Noor,

I am not saying this to be mean but this topic is long the subject matter
not easily containable in a post.

Perhaps you should consider hiring a consultant (me for example :)) or
buying a book.The only way I learned anything about Word is long hard hours
of study - and I still have a lot to learn.
 
R

Rob Nicholson

Perhaps you should consider hiring a consultant (me for example :)) or
buying a book.The only way I learned anything about Word is long hard hours
of study - and I still have a lot to learn.

And the other thing to watch out is that Microsoft states that the Word
object model is *not* designed to be used outside of Word. We've used the
spell checker and print preview functionality in our application and it's
caused many, many problems. Word itself assumes it has full control and will
close down Word in your app without asking in some circumstances.

I did hear that this situation possibly changed in Office XP but I've not
had any experience of that.

Regards, Rob.
 
S

scorpion53061

And the other thing to watch out is that Microsoft states that the Word
object model is *not* designed to be used outside of Word.

I have no doubt you are right.

But I have a boss who wants reports and he wants to see them in MS Word and
the applications I build to use MS Word as the interface. He likes MS Word.

He can be kind of demanding that way. :)

He totally and completely was horrified by Crystal Reports.

But hey at least I am working right?
 
R

Rob Nicholson

But I have a boss who wants reports and he wants to see them in MS Word
and
the applications I build to use MS Word as the interface. He likes MS
Word.

Generate HTML documents and let Word load them? He might not spot the
difference :)

Rob.
 
S

scorpion53061

Believe it or not I tried that!!! You know where I got bit?

On the page breaks.......I wasn't able to do it as cleanly as I might have
in a regular word doc.......

That was theend of that experiment :(
 
R

Rob Nicholson

On the page breaks.......I wasn't able to do it as cleanly as I might have
in a regular word doc.......

Ahh well plain HTML doesn't have page-breaks :) XML?

Cheers, Rob.
 
S

scorpion53061

Hi Rob,

Now that is an interesting concept I have not thought of. How would you use
XML to overcome that issue?
 
R

Rob Nicholson

Now that is an interesting concept I have not thought of. How would you
use
XML to overcome that issue?

If you save a Word document out in XML, you can look at how Word uses
XML/HTML to store the document. For example, here's a simple document
containing Page 1<PAGE BREAK>Page 2.

It should be relatively easy to build a document like this from code.

Regards, Rob.

<html xmlns:blush:="urn:schemas-microsoft-com:blush:ffice:blush:ffice"
xmlns:w="urn:schemas-microsoft-com:blush:ffice:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./Example_files/filelist.xml">
<title>Page 1</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>Rob Nicholson</o:Author>
<o:LastAuthor>Rob Nicholson</o:LastAuthor>
<o:Revision>1</o:Revision>
<o:TotalTime>1</o:TotalTime>
<o:Created>2004-01-18T13:30:00Z</o:Created>
<o:LastSaved>2004-01-18T13:31:00Z</o:LastSaved>
<o:pages>2</o:pages>
<o:Words>2</o:Words>
<o:Characters>12</o:Characters>
<o:Lines>1</o:Lines>
<o:paragraphs>1</o:paragraphs>
<o:CharactersWithSpaces>14</o:CharactersWithSpaces>
<o:Version>9.6926</o:Version>
</o:DocumentProperties>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head>

<body lang=EN-GB style='tab-interval:36.0pt'>

<div class=Section1>

<p class=MsoNormal>Page 1</p>

<span style='font-size:12.0pt;font-family:"Times New
Roman";mso-fareast-font-family:
"Times New Roman";mso-ansi-language:EN-GB;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA'><br clear=all style='page-break-before:always'>
</span>

<p class=MsoNormal>Page 2</p>

</div>

</body>

</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top