473,395 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Generating ms word document in .net

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

Nov 20 '05 #1
10 1893
Noor wrote:
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.

--
chris
Nov 20 '05 #2
Nope.. i cant rely on pdf..

anyone has any other idea?

thanks

Noor
"chris" <ne********@boxfrog.com> wrote in message
news:So********************@comcast.com...
Noor wrote:
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.

--
chris

Nov 20 '05 #3
> > > 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.


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.
Nov 20 '05 #4
> 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.
Nov 20 '05 #5
> 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?
Nov 20 '05 #6
> 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.
Nov 20 '05 #7
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 :(
Nov 20 '05 #8
> 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.
Nov 20 '05 #9
Hi Rob,

Now that is an interesting concept I have not thought of. How would you use
XML to overcome that issue?
Nov 20 '05 #10
> 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:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office: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>
Nov 20 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark | last post by:
Hi - apologies in advance if this is not the correct forum - tried searching loads, and still to find a workable solution. Generating a word document from ASP - no problem. Inserting page breaks...
5
by: Rimantas Žukaitis | last post by:
Hi, we are developing server side report generation application with .NET. The problem is, that we have to present same data in diferent formats (HTML, PDF, WORD, EXCEL). This has to be done...
0
by: Novice | last post by:
Hi all, I'm a novice VB.NET and VBA programmer and am wondering if there is a tutorial out there on how to create a word document based on data in a database and then return that document to a web...
0
by: Vimal | last post by:
Hi , Can anyone tell me how to generate a Word document with Header and Footer using Microsoft Office Html and XML Reference. Thanks you so much!
3
by: zxc | last post by:
hi i want to ask how can we retrieve data from MS sql server table northwind and generate report of same data in formated form in MS word using VB.net ... i need its code can any one help please...
4
by: lorna.mitchell | last post by:
I hope I'm not repeating a question or missing any good resources but I really can't figure out the best way to progress with my problem. We'd like to use apache fop to generate documents in both...
2
by: dawnm.jordan | last post by:
Hi, I am working on a database used to store information, and then generate customized letters. I have most of it working, (Thanks to the posts in this group =)) I have a button which can be...
13
by: yasodhai | last post by:
Hi, I developed a web application which contains a text box and a command button. Once if i enter some text and then if i click the command button, the contents in the textbox should be displayed...
0
by: srk | last post by:
hi to all, i need some help , my problem is that i have to generate a word document withe the data from data base and it should be displayed as tables in word and i have to insert some header and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.