Word makes random bugs when pasting HTML with images

P

Paul Schmidinger

Hello,

A web-application outputs a html-page with images in it. To allow the user
to edit the page before printing it, he is beeing instructed to copy it to
MS Word, edit it and print it when done.

Simplified example for that page:
http://www.eigelb.at/word/test.html

Note that the images have been made smaller than they are using the
width-attribute. Reason: To increase the print-quality (better than the
screen's 72 dpi).

Now the problem is this: When I copy the document to MS Word (set zoom to
100% first), a bug appears *at random*. The bug is: The image is much too
large, the width-attribute is beeing ignored. The bug happens on a random
basis, sometimes it doesn not occur at all, sometimes it occurs several
times on a single paste. (The "real" document is quite big so at least
several bugs occur *all* the time) If you can not reproduce the bug, try
pasting up to 20 times.

This problem occurs on different versions of Word, including Word 2000 and
Word 2002. Has been tested on many different PCs, the problem occurs
everywhere.

I tried different techniques to implement the size in HTML, always the same
problem.

Can anybody help?

Kind regards,
Paul Schmidinger
-- www.eigelb.at
 
B

Bob Buckland ?:-\)

Hi Paul,

There are a variety of factors involved that can effect what you see in Word when you use Word's HTML formatted pasting and some of
them are discussed below, and you may already be aware of their impact..

Having said that <g>, it does appear that there may be a Word bug related to the clipboard and HTML and I'm doing some further
checking on that. There are also possible misunderstandings of how the settings within
Word impact results or expectations for handling of HTML related data

Perhaps the easiest way is to cover give a couple of these variables is with short examples based on your sample page at
http://www.eigelb.at/word/test.html.

On that page you have used a single graphic, in the PNG format
http://www.eigelb.at/word/Kennwert_SO8_SKWT27_big.png.
You repeat the graphic on the page in 7 rows of 3 copies of the graphic but using a webpage construct that does not use tables (i.e.
no rows and cells). Each of the 'rows' is created by separating the group of 3 graphics with two line breaks –

=======[Web document construct example] =====================
<img width="10%" src="nameofyourpicturehere">
<img width="10%" src="nameofyourpicturehere">
<img width="10%" src="nameofyourpicturehere">
<br><br>
======================================================

Your construct is going to impact the pasting into Word as are the settings at

[A] Tools=>Options=>General=>[Web Options]=>/Pictures\

(Note: In Word 2000 the results may further vary as changing those options didn't always 'take' until Word 2000 was restarted,
especially if the Office 2000 HTML v2 add-in was installed).

With the construct you used, the graphics will scale as you reduce the size of the web browser window from full screen down to, for
example. say a 3" x 5" card size. To illustrate, with the sample web page on the screen in Internet Explorer right click on the top
left picture on the web page and in Properties note the picture size given in pixels (px). Close the property window, right click on
the graphic, select copy, then paste that into a blank Word document while you're in Print Layout view.

Next drag the size of the web browser window down to a much smaller size then repeat the previous steps
(right click on the top left picture and look at the size in pixels under properties and compare that to the prior size, then right
click copy and paste into Word next to the previous graphic. If both are the same size, then which size is 'correct' as they
appeared differently in your browser in each scenario?

Here, when copying and pasting just the picture, Word is looking at the properties from the picture itself. It is ignoring the
browser window size 'adjustments' but it is paying attention to the settings in

Tools=>Options=>General=>[Web Options]=>/Pictures\

Double click on the first pasted graphic in your Word document and in the Size tab of Format=>Picture what is the width (Word's
dialog insists on giving height first) of the pasted graphic? (Note also the 'scale' percentages [Word is aware of the reported
original size of a graphic]

If you next look at the feature settings [A] for Target Monitor Screen Size is the picture 10% of that width (which is the width you
specified in your construct)?
If not, change the Pixel per Inch setting to 96PPI and paste the graphic again on a new line in the Word document and recheck.

If the graphic you insert or paste does not contain a PPI value (the PNG graphic you used does not) then Word uses the setting in
the[A] dialog for PPI or the default for that graphic type. Windows screen graphics default to 96PPI as do GIF and PNG graphics
(72PPI is Mac screen resolution, 96 is Windows default). PNG and JPG (as examples) can store the PPI value in the graphic. (a
pixel has no set 'size' and is interpreted by apps using the 'scale' that app has set for inserting and displaying a graphic).

Where the bug appears to be coming in is with something happening in the clipboard interface. For example - - if I use IE and when
displaying your test page use ctrl+a to select the whole page and then ctrl+c to copy that page then switch to a new Word document,
set print layout view and in [A] use 1600x 1200 with 96PPI and then use Ctrl+v to paste the page, Word is ignoring the settings for
the first two rows of pictures, but then gets the other rows per the settings.

To workaround the problem if you use the icon in Internet Explorer to select 'Edit in Microsoft Word' or from inside Microsoft Word
use File=>Open and navigate to that page and open the file all rows come in 'correctly' for the settings in [A].

If users aren't aware of the [A] settings in Word, or if you're not locking down those settings, you may still get inconsistent or
unexpected results in Word edited web documents, even when the pasted data is handled correctly.
The random issue you mentioned when pasting may also be from a shared Office feature in the clipboard in pasting the HTML, but, it
can also occur when you're copying a section of a web page and pasting into Word and you are impacted by various constructs,
including table settings, in Word (Word 2000 needed a registry change to work with percentage widths, for example) when you 'grab'
only part of a web page.

FWIW, PNG graphics generally print fairly well as far as resolution.


===========
Hello,

A web-application outputs a html-page with images in it. To allow the user
to edit the page before printing it, he is beeing instructed to copy it to
MS Word, edit it and print it when done.

Simplified example for that page:
http://www.eigelb.at/word/test.html

Note that the images have been made smaller than they are using the
width-attribute. Reason: To increase the print-quality (better than the
screen's 72 dpi).

Now the problem is this: When I copy the document to MS Word (set zoom to
100% first), a bug appears *at random*. The bug is: The image is much too
large, the width-attribute is beeing ignored. The bug happens on a random
basis, sometimes it doesn not occur at all, sometimes it occurs several
times on a single paste. (The "real" document is quite big so at least
several bugs occur *all* the time) If you can not reproduce the bug, try
pasting up to 20 times.

This problem occurs on different versions of Word, including Word 2000 and
Word 2002. Has been tested on many different PCs, the problem occurs
everywhere.

I tried different techniques to implement the size in HTML, always the same
problem.

Can anybody help?

Kind regards,
Paul Schmidinger>>
--
Let us know if this helped you,

Bob Buckland ?:)
MS Office System Products MVP

*Courtesy is not expensive and can pay big dividends*

For Everyday MS Office tips to "use right away" -
http://microsoft.com/events/series/administrativetipsandtricks.mspx
 

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