Question: Is it possible to set the export to landscape mode versus portrait? I'm happy to do the heavy lifting if I can be pointed in the right direction. Also, is it possible to set margins as well? I'd imagine this is possible through some modifications/additions to the CSS and head information views-data-export-doc-header.tpl.php template file.

This module is super handy, but unfortunately my tables extend a bit horizontally, hence the request. Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rickmanelius’s picture

Title: Landscape mode for word documents export » Landscape mode when exporting a word document
Anybody’s picture

These links may help you:

http://sebsauvage.net/wiki/doku.php?id=word_document_generation
http://www.codeproject.com/Articles/7341/Dynamically-generate-a-MS-Word-...
http://stackoverflow.com/questions/13340216/html-generated-microsoft-wor...

I furthermore marked related issues.

I'll write a blog post about my solution (views-data-export-doc-header.tpl.php changes) on my blog http://Julian.Pustkuchen.com and post a link here for reference.

Anybody’s picture

Status: Active » Needs review
FileSize
4.32 KB

Finally my blog post about .doc-document formatting for HTML documents exported to .doc can be found here: http://julian.pustkuchen.com/node/722

I've added my results as patch to this issue and I'd suggest to apply them to the project to provide a default formatting and easy & clean change of formats by overriding the header .tpl.php file from the module for individual changes.

For this specific issue you'd simply have to change "mso-page-orientation: portrait;" to landscape.

Please let's discuss to add this default formatting to the great views_data_export.module.

Thanks a lot!

Anybody’s picture

PS: I'm using that template files in production, it works great and as expected.

Anybody’s picture

Title: Landscape mode when exporting a word document » Provide default page formatting for .doc files (portrait / landscape, margins, page view, zoom, etc.)

Changed the title of this issue to a more general one because it solves several related issues.

biarr’s picture

The patch is working. I'm also using it in production. Thanks

biarr’s picture

Status: Needs review » Reviewed & tested by the community

Changing the status

schatzcoop’s picture

Attempting to apply this patch I get:

patch unexpectedly ends in middle of line
patch: **** Only garbage was found in the patch input.

Even if I set to Unix line-endings...

Edit: I applied manually but found that there is an errant "\ No newline at end of file" on line 63. The changes below it are part of the same file, views-data-export-doc-header.tpl.php

MatthijsG’s picture

Get the same error as #8
Manually patching worked, don't added the two /-lines

fakir22’s picture

mso-page-orientation: landscape; didn't worked for me so I simply inverted values for size parameter (changed
size: 21cm 29.7cm; for size: 29.7cm 21cm;) and it seems to work ;)