This topic is locked

Help On Export To Excel

1/25/2013 3:23:15 AM
PHPRunner General questions
M
mmponline author

I have some specific need on excel export and would appreciate some help on this.

  1. When I export a description field the info is displayed in one long line instead of wrapping the text in a neat paragraph. Is there a way to configure the export to automatically export the is line and wrap the info?
  2. I export the pictures as well and they show fine. Unfortunately they are all different sizes. Is there a way to make these pictures to have as Eg. all the same width?
    Thank you for any guidelines on this.

W
wildwally 1/25/2013

PHP Runner utilizes the PHPExcel class/library to accomplish the export capability. Perhaps you could create/modify your own export file to accomplish what you want, documentation and examples can be found at the phpexcel.codeplex.com. It rather easy to do once you dig into the examples and documentation to understand whats taking place.
I know it's not a ready to go solution, but i hope it points you in the right direction.

M
mmponline author 1/28/2013

Thanks Wally, will give it a try.

M
mmponline author 1/28/2013

Wally (and others that can help please)
I'm trying to get this working. On the page http://www.orchidssa.co.za/db6/orchidsQuicklist_list.php I marked a few products and then exported it after making some changes to the orchidsQuicklist_export.php file. I'm not sure if this is the right file but the details looks like it where it should be done. I found the following code:

$totalsFields[] = array('fName'=>"Price", 'totalsType'=>'', 'viewFormat'=>"Currency");

$totals["Description"] = array("value" => 0, "numRows" => 0);

$totalsFields[] = array('fName'=>"Description", 'totalsType'=>'', 'viewFormat'=>"");


I for instance removed the Currency part of the format, to see at least if the info changed, but the output Excel spreadsheet does not change, so I think I'm not changing in the right place. I even added the Currency to another field, just to check, but the output stays the same. I'm not sure if I'm in the right file or maybe there is other places to check as well.
It seems like the code for wrapping (according to http://phpexcel.codeplex.com/discussions/18434topic) should be setWrapText(true) to be added to the Description's viewFormat part, but obviously I can't verify this before I know I do it in the right place.
Any help appreciated.

W
wildwally 1/29/2013

The admins or someone else can correct me if I'm wrong, but the yourpage_export.phpdoesn't actually do the work of the export. It sets everything up and then redirects to the export_function.phpfile which is the file that uses the PHPEXCEL plugin. And to prevent messing with the basic export I suggest you preserve the original documents. Create a copy of the export_function.phpname it something different and have the specific page use the modified version instead of the generic excel export.
**edit - should not the export_function is in the include folder.

M
mmponline author 1/30/2013

Wally
You're right that the functions file actually write the export it seems. However, the values according to me must be drawn from the yourpage_export.php file (nd maybe somewhere else as well) as the functions file has no place to set the specifics. The functions file has the following code:

$totalsFields[] = array('fName'=>$value, 'totalsType'=>$totalsType, 'viewFormat'=>$pageObj->pSet->getViewFormat($value));


and according to me, it should pull the getViewFormat($value) for the description from the line in the yourpage_export .php file:

$totalsFields[] = array('fName'=>"Description", 'totalsType'=>'', 'viewFormat'=>"DETAILS HERE OF THE FORMAT");


As said though, I've tried to edit this file with no changes to the exported file.

Not sure what we're missing and how. Maybe someone else can shed light on this.