I want to open a word document and display all the text in a windows forms.
Like the Ms Word Viewer. Only for read it, no modify.
I do not have problems opening and reading the document. The problem is
display de text. I do it of the following form:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
filename = "C:\1.doc"
Wrd.Documents.Open(filename, confirmConversions, rd, addToRecentFiles,
passwordDocument, passwordTemplate, revert, writePasswordDocument,
writePasswordTemplate, format, encoding, vis)
End Sub

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim range As Object
Dim str As New System.Text.StringBuilder
Dim drawfont As Font
Dim drawbrush As SolidBrush
Wrd.ActiveDocument.Range.SetRange(0, Wrd.ActiveDocument.Words.Count)
Wrd.ActiveDocument.Range.Start = 0
Wrd.ActiveDocument.Range.End = Wrd.ActiveDocument.Words.Count - 1
For Each Rng In Wrd.ActiveDocument.Words
' Create font and brush.
drawfont = New Font(Rng.Font.Name, Rng.Font.Size, FontStyle.Regular)
drawbrush = New SolidBrush(Color.Black)
Dim drawFormat As New StringFormat
drawFormat.FormatFlags = StringFormatFlags.DirectionVertical
' Draw string to screen.
str.Append(Rng.Text & " ")
Next
e.Graphics.DrawString(str.ToString, drawfont, drawbrush, x, y)
End Sub
'I don´t use any text editor because I won´t edit the text, only read.
Some suggestion?

Re: Display Word document text in Windows Forms without text editor by InK_

InK_
Fri Sep 16 05:37:51 CDT 2005

Hi
Why don't you do it with any text control in readonly mode?
Is using graphics necessary?

Regards, InK_


"Salvador - From Galicia (Spain)"
<SalvadorFromGaliciaSpain@discussions.microsoft.com> wrote in message
news:735592DC-0120-4C30-9962-BCC784109F67@microsoft.com...
> I want to open a word document and display all the text in a windows
forms.
> Like the Ms Word Viewer. Only for read it, no modify.
> I do not have problems opening and reading the document. The problem is
> display de text. I do it of the following form:
>
> Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
> Handles MyBase.Load
> filename = "C:\1.doc"
> Wrd.Documents.Open(filename, confirmConversions, rd, addToRecentFiles,
> passwordDocument, passwordTemplate, revert, writePasswordDocument,
> writePasswordTemplate, format, encoding, vis)
> End Sub
>
> Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
> System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
> Dim range As Object
> Dim str As New System.Text.StringBuilder
> Dim drawfont As Font
> Dim drawbrush As SolidBrush
> Wrd.ActiveDocument.Range.SetRange(0, Wrd.ActiveDocument.Words.Count)
> Wrd.ActiveDocument.Range.Start = 0
> Wrd.ActiveDocument.Range.End = Wrd.ActiveDocument.Words.Count - 1
> For Each Rng In Wrd.ActiveDocument.Words
> ' Create font and brush.
> drawfont = New Font(Rng.Font.Name, Rng.Font.Size, FontStyle.Regular)
> drawbrush = New SolidBrush(Color.Black)
> Dim drawFormat As New StringFormat
> drawFormat.FormatFlags = StringFormatFlags.DirectionVertical
> ' Draw string to screen.
> str.Append(Rng.Text & " ")
> Next
> e.Graphics.DrawString(str.ToString, drawfont, drawbrush, x, y)
> End Sub
> 'I don?t use any text editor because I won?t edit the text, only read.
> Some suggestion?




Re: Display Word document text in Windows Forms without text edito by SalvadorFromGaliciaSpain

SalvadorFromGaliciaSpain
Fri Sep 16 06:08:01 CDT 2005

If I don´t find any text control that display the document´s text like Ms
Word Editor.
Graphis aren´t necessary but i don´t fin other solution.

"InK_" wrote:

> Hi
> Why don't you do it with any text control in readonly mode?
> Is using graphics necessary?
>
> Regards, InK_

Re: Display Word document text in Windows Forms without text editor by Kalpesh

Kalpesh
Fri Sep 16 06:52:47 CDT 2005

Hi,

Using a richtextbox would help in this case
You can load the word document into RTF box & make the RTF box readonly

Does this help ?

Kalpesh


Re: Display Word document text in Windows Forms without text edito by InK_

InK_
Fri Sep 16 07:20:24 CDT 2005

RichTextBox control for example
regards,
InK_

"Salvador - From Galicia (Spain)"
<SalvadorFromGaliciaSpain@discussions.microsoft.com> wrote in message
news:58CF7DA1-7FBD-411A-A94D-404E9C115E43@microsoft.com...
> If I don?t find any text control that display the document?s text like Ms
> Word Editor.
> Graphis aren?t necessary but i don?t fin other solution.
>
> "InK_" wrote:
>
> > Hi
> > Why don't you do it with any text control in readonly mode?
> > Is using graphics necessary?
> >
> > Regards, InK_




Re: Display Word document text in Windows Forms without text edito by SalvadorFromGaliciaSpain

SalvadorFromGaliciaSpain
Fri Sep 16 09:01:03 CDT 2005

OK, I am going to use de richtexbox control in readonly mode.
Thank you for the replies.

"Kalpesh" wrote:

> Hi,
>
> Using a richtextbox would help in this case
> You can load the word document into RTF box & make the RTF box readonly
>
> Does this help ?
>
> Kalpesh
>
>