HTML generated Microsoft Word document with header, footer and watermark

后端 未结 3 1787
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 03:58

I\'m looking for an example of a Microsoft Word Document generated by HTML. It should contain a header, footer and a watermark.

3条回答
  •  被撕碎了的回忆
    2020-12-01 04:27

    Try:

    
    

    For a full example:

    
    

    I'm not terribly familiar with VML and embedding images in Word, but as far as things go it suits my purposes and I'm able to embed it into a Word document. Word will automatically handle the embedding on first load.

    Just keep in mind that the default measurement in Word is both centimetres and points, so you have to do it all in points. Probably a good way is to embed the image first off, open in Word, resize if you have to and get the image measurements through word. Then go back to your application and set the width & height. Try to keep the same ratio that Word sets otherwise it'll resize your image. At least that's what Word has been doing to me.

    EDIT:

    I revised the above image example - it works on some versions of word but doesn't embed the image. You'll get an alert each time you open the file asking you if you want to download an external file. If your office security settings prevent you from doing that, you'll need to embed the file using the first answer, which I've confirmed to work with office 2007+:

            

    Place this in the section: