Prevent Word from Reformatting my HTML
Posted
by Jonathan
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan
Published on 2010-05-11T09:37:53Z
Indexed on
2010/05/17
8:10 UTC
Read the original article
Hit count: 215
I have an HTML page that needs to open in word. I created the document in word and saved the document as an HTML document. So word spits out all its nasty HTML syntax. This is the opened through internet explorer which will display the word document within the browser.
When I view the page word modifies some of the tags. More specifically it adds a Width and Height tag and ignores the width and height within the style tag. If I try setting the Width and Height tags it overrides with new values. I have tested on different environments and get different results as word makes decision how to handle.
A bit of background this img starts off as this, and is rendered via data rendering syntax.
<asp:Image id="as" runat="server" Src"<%# ImgSource %>" style="width:178px;height:130px" />
It ends up like this in word
<img width=32
height=32 id=barCodeImage
src="http://myurl/BarcodeImages/1136574_129180418198008169.png"
style='border-bottom-width:0px;border-left-width:0px;border-right-width:0px;
border-top-width:0px;height:130px;width:178px'>
I want to stop word from reformatting the HTML.
© Stack Overflow or respective owner