Using cfcontent in ColdFusion 7, how do I output an MS Word doc in landscape mode?
-
18-09-2019 - |
Question
The title is pretty self explanatory. I'm using cfcontent in ColdFusion 7 to output a page as an application/msword file type and I want to know how to make it default to landscape mode without resorting to downloading a third party library.
Solution
If the content is just html, you could use the mso/xml schemas. There is a bit more to it than this, but the "mso-page-orientation" property should do the trick.
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
...
<style>
<!--
@page Section1
{ size:11.0in 8.5in;
mso-page-orientation:landscape;
...
}
-->
</style>
For a good quick start, create a very simple document in MS Word. Change the orientation etcetera and save it as html. The generated html will be a bit verbose, but is pretty easy to understand.
OTHER TIPS
If you are creating an rtf-based document, review this page for some ideas:
I don't know how helpful this is, but I created a simple RTF file in MS-Word, and then looked at it. I found the following in some of the formatting:
\paperw15840\paperh12240
15840 is 1440 * 11 12240 is 1440 * 8.5
There are links to other sites including the rtf specification on that page.