ASP.net dynamically generate MS Word document (2)

MS Word treat this generated “Word” document differently

When clicking download generated document, IE will pop up “File Download” dialog as expected. However when opening the downloaded document, MS Word will be in “Web Layout View” instead of “Print Layout View”.

Let MS Word “thinks” this is true word document and open in “Print Layout View” with zoom “90%

Replace original Visual Studio automatically generated .aspx header with the following code










OK! Now when MS Word opens this html style Word document, it more likely opens a real Word document.

Another issue comes up that MS Word is so smart, and it automatically breaks the page.

If you want to break the page on a certain position, you can insert the following code into your html style Word document.

Previous page

Next page

One thought on “ASP.net dynamically generate MS Word document (2)”

  1. I’d need to take a look at with you right here. Which can be not something I normally do! I get enjoyment in studying a article that will make people assume. Furthermore, many thanks for permitting me to comment!

Comments are closed.