How to create a web page for minimal format loss when pasting into MS Word

I am developing a web application, and I want users to be able to copy some parts of the page and paste them into MS Word with minimal loss of html formatting. For example, users should be able to copy only the table from the page and paste it into the word with minimal loss (suppose that the page contains the required average, scripts to select only one table or div).

How do I develop html so that users can copy-paste with minimal loss? For example, whether to use tags like b, I instead of css, whether to use inline css, etc.

+4
source share
2 answers

As long as you don't rely on external CSS, you're good; either inline CSS, or tags like B will do the trick. If probobly stick to CSS2 - no CSS3 attachment. Of course, use only websafe fonts, they should be available on the client machine. If users can copy multiple container elements that you might want to create using tables rather than divs. Keep to a strict arrangement and do not use absolutely positioned elements and the like. Strive for a strict, square and narrow layout that fits well with the a4 page.

+1
source

If you know what your users will insert, the save option is to make this part on a separate page so that it can be easily inserted.

By default, MS-Word will give the same formatting, but the width is always fixed, which can cause some problems (too wide or too narrow).

Another thing to keep in mind is that copying from a website always follows an HTML stream, not how it can be displayed in a browser. Thus, all inserted data must be contiguous in HTML.

Be careful:

  • absolute positioned elements, overlays, etc.
  • Elements that are scripted or dynamically loaded using Ajax

Scripts will always be dropped

To test this, just paste something into the word and save the word file in HTML. See how it looks.

0
source

All Articles