Web text paste into Word, style

G

Guest

I am leading a team that has created a web-based application/database that
also generates a report in a Word template. The issue we are having is that
the template requires a specific text "Style" (0), set by our internal
Document Service organization. We currently copy the text from the
application - Rich Text Boxes, WYSIWYG (stored in Oracle as HTML) and paste
it into the Word template and it is pasted with the "Normal(Web)" style. We
then have to re-format the text back to Style "0", and loose certain
formatting features, i.e. centered text, bullets in lists, etc. My
programmer is looking at parsing. Is there another way to transfer the text,
maintain the formatting, and keep the required text Style "0"?
 
G

Graham Mayor

The macro

Selection.Style = ActiveDocument.Styles("0")
On Error GoTo oops
Selection.PasteSpecial , DataType:=wdPasteText
End
oops:
Beep



will paste the text as unformatted in "0" style, but the result will depend
more on the format of the style than the source material.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

You mention that the text will be, "unformatted in '0' style"... This is
where we currently are, and I am attempting to maintain the formatting from
the application into the Word document, simply change the style to '0' (I
want to maintain text justification, bulleting, etc.). The application is
developed with JavaScript with an Oracle back-end. Is there a way to
maintain the text formatting while changing the style.

The user can manually re-bullet the lists and align the text after the style
has been changed to "0" in the document produced, but the idea of the
application is to generate the report automatically and eliminate the need
for the user to spend time formattting. Is there anything else I can try?
 
G

Graham Mayor

The problem is that html and Word document formats are different. You can
either paste with all the formatting of html or none of it. I know of no way
to selectively paste oddemsts of formatting. The macro simply imports the
text formatted with your Style 0 applied.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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