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!

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
StatusFileSize
new4.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 ;)

steven jones’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

Sorry for the lack of attention to your issue, please accept my apologies.

Drupal 7 is going to be end-of-life'd by the community in approximately 1 month.

As such, I am closing all non-critical looking, non-PHP compatibility issues for Views Data Export to tidy up the issue queues and reduce the noise. You can read about this on #3492246: Close down Drupal 7 issues.

If you feel like this issue has been closed by mistake, please do comment about re-opening it.
If you feel like the ticket is still relevant for the 8.x-1.x version of the module, then please search for a duplicate issue first, and if there really isn't one (and you've looked properly) then change the version on the ticket and re-open.

Thanks to everyone involved in this issue: for reporting it, and moving it along, it is truly appreciated.
The Drupal community wouldn't be what it is today without your involvement and effort, so I'm sorry that we couldn't get this issue resolved. Hopefully we'll work together in a future issue though, and get that one resolved :)