Copy Paste from IE to Word(2003), re-style text, maintain formatting

  • Thread starter delphis96 via OfficeKB.com
  • Start date
D

delphis96 via OfficeKB.com

Working with a team that has created a web application (javascript with
oracle back end). One of its functions is to auto-generate a document based
on a pre-defined template, using a custom Style. We currently copy the text
(stored as HTML in Oracle) from IE and paste it into the Word document. It
pastes successfully with all formatting intact, but does not pick up the new
Style. When we change the Style, all of the formatting is lost.

Is it possible to copy text from IE into Word (2003), re-style in Word, and
retain the formatting? Please help.
 
C

Cindy M.

Hi Delphis96,
Working with a team that has created a web application (javascript with
oracle back end). One of its functions is to auto-generate a document based
on a pre-defined template, using a custom Style. We currently copy the text
(stored as HTML in Oracle) from IE and paste it into the Word document. It
pastes successfully with all formatting intact, but does not pick up the new
Style. When we change the Style, all of the formatting is lost.

Is it possible to copy text from IE into Word (2003), re-style in Word, and
retain the formatting? Please help.
You don't provide enough information about the Style, what you expect from it
and the formatting that is lost.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
D

delphis96 via OfficeKB.com

Cindy,

I apologize for not providing more detail up front. The text is coming from
a web application (IE), using the FCKeditor - which provides RTF boxes for
the report's body text to be entered into and formatted (i.e. bold, italics,
underline, bulleted lists, numbered lists, indents, justification, etc.).
The RTF text is stored in Oracle as HTML, but when it comes time for report
generation, the text (RTF) is copied from IE and pasted into MS Word 2003.

The text then needs to re-styled (in MS Word 2003) to meet an internal
Document Service Department's template requirement, which is called "0". It
is similar to "Normal", but has 0 indent, Arial 11pt, and controls the
spacing before and after a paragraph. The reason they created this "Style"
is that it produces the best document in the end when converted to PDF. This
is a defined process, by our Document Service Group, we must submit in Word,
and they convert (and password protect) the documents into PDF.

We can successfully paste the text into Word, from IE, and it has all of its
formatting intact (i.e. bold, italics, underline, bullets, indents,
justification, etc.) - and it will typically paste in as style "Normal" or
"Normal(Web)". When the text is re-styled to "0", we lose bulleting, and in
some cases also the other text formatting (bold, italics, etc.). We have
tried changing the default "paste" option to paste in style=0, but we still
lose bullets, center justification, and indents. We also tried creating a
style "0" in the web-based text editors in hopes that Word would recognize
the style, but we were not successful with that either (it was not recognized
in Word).

Any help you could provide on how to paste in the text, re-style it to "0",
and maintain all formatting (bold, italics, underline, bullet lists, indents,
justification, etc.) would be greatly appreciated.
Hi Delphis96,
Working with a team that has created a web application (javascript with
oracle back end). One of its functions is to auto-generate a document based
[quoted text clipped - 5 lines]
Is it possible to copy text from IE into Word (2003), re-style in Word, and
retain the formatting? Please help.

You don't provide enough information about the Style, what you expect from it
and the formatting that is lost.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Cindy M.

Hi Delphis96,
I apologize for not providing more detail up front. The text is coming from
a web application (IE), using the FCKeditor - which provides RTF boxes for
the report's body text to be entered into and formatted (i.e. bold, italics,
underline, bulleted lists, numbered lists, indents, justification, etc.).
The RTF text is stored in Oracle as HTML, but when it comes time for report
generation, the text (RTF) is copied from IE and pasted into MS Word 2003.

The text then needs to re-styled (in MS Word 2003) to meet an internal
Document Service Department's template requirement, which is called "0". It
is similar to "Normal", but has 0 indent, Arial 11pt, and controls the
spacing before and after a paragraph. The reason they created this "Style"
is that it produces the best document in the end when converted to PDF. This
is a defined process, by our Document Service Group, we must submit in Word,
and they convert (and password protect) the documents into PDF.

We can successfully paste the text into Word, from IE, and it has all of its
formatting intact (i.e. bold, italics, underline, bullets, indents,
justification, etc.) - and it will typically paste in as style "Normal" or
"Normal(Web)". When the text is re-styled to "0", we lose bulleting, and in
some cases also the other text formatting (bold, italics, etc.). We have
tried changing the default "paste" option to paste in style=0, but we still
lose bullets, center justification, and indents. We also tried creating a
style "0" in the web-based text editors in hopes that Word would recognize
the style, but we were not successful with that either (it was not recognized
in Word).

Any help you could provide on how to paste in the text, re-style it to "0",
and maintain all formatting (bold, italics, underline, bullet lists, indents,
justification, etc.) would be greatly appreciated.
Basically, you can't do it this simply. In a Word document, styles are the
basis of formatting at the paragraph and the character level. Applying one
style over other formatting will dump the other formatting, the only exception
is that character formatting will be retained under certain circumstances (how
large a percentage of the text has the different formatting).

As soon as you apply style "0", all paragraph-level formatting (which includes
bullets, indents and justification) will be lost. That's just how Word is
designed to work.

As possible solutions, I can imagine

1. Loop through all the paragraphs in the document, note the special formatting
for each paragraph, apply the style, then loop through again and reapply the
special formatting

2. Transform the RTF (or HTML) to WordProcessingML. You should be able to do
this, including the style tag for the paragraphs and retaining the special
formatting.

Neither approach will be "trivial", but both should be doable. I'd lean towards
(2), as retaining the character formatting should be simpler/more efficient. If
all this is just for generating PDFs (no other purpose), it would probably be
worth looking at transforming directly in the XML format for PDF...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
D

delphis96 via OfficeKB.com

Cindy,

Thank you so much for the feedback. I certainly don't expect the answer to
be 'easy'... I honestly just need one that works (haha). We will be trying
several different concepts, and your number two is certainly up on the list
of fixes to apply. I'll let you know how it goes.

As far as it ultimately becoming a PDF, there is a process requirement that
we generate a Word document to be submitted. I think if we could submit a
PDF, there would most likely be a much less complex solution. We have
inquired about the ability to generate and submit PDF's directly, and have
not received positive response. Maybe that will change in the future. For
now, we are trying several different options to solve our current 'dilema'.

Again, thank you very much for your suggestions.

Kindest Regards,
John
Hi Delphis96,
I apologize for not providing more detail up front. The text is coming from
a web application (IE), using the FCKeditor - which provides RTF boxes for
[quoted text clipped - 25 lines]
and maintain all formatting (bold, italics, underline, bullet lists, indents,
justification, etc.) would be greatly appreciated.

Basically, you can't do it this simply. In a Word document, styles are the
basis of formatting at the paragraph and the character level. Applying one
style over other formatting will dump the other formatting, the only exception
is that character formatting will be retained under certain circumstances (how
large a percentage of the text has the different formatting).

As soon as you apply style "0", all paragraph-level formatting (which includes
bullets, indents and justification) will be lost. That's just how Word is
designed to work.

As possible solutions, I can imagine

1. Loop through all the paragraphs in the document, note the special formatting
for each paragraph, apply the style, then loop through again and reapply the
special formatting

2. Transform the RTF (or HTML) to WordProcessingML. You should be able to do
this, including the style tag for the paragraphs and retaining the special
formatting.

Neither approach will be "trivial", but both should be doable. I'd lean towards
(2), as retaining the character formatting should be simpler/more efficient. If
all this is just for generating PDFs (no other purpose), it would probably be
worth looking at transforming directly in the XML format for PDF...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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