Categories > OpenTBS with DOCX >

Merging of Cells Vertically

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jayant
Date: 2013-04-16
Time: 13:45

Merging of Cells Vertically

Hi Everyone,

I am using this plugin and badly stuck at one point.  :( :(

i am trying to merging a cells vertically. I have a specific field in my data set. On which basis i would like to group or merge the rows.

Like Column A have 3 type of specific values and there are 10 rows and there is a 5 columns in my table. So i would like to display them like
Column A(merge with specific value) Column B and so on...

So, for the only first column i want to merge cells according to specific value of. Right now its showing me 10 records but not a merging in column A according to the specific value.

Simply i just want to know how do i perform a merging of cells on condition basis vertically.

Thanks in Advance.

Thanks and Regards,
Jayant
By: Skrol29
Date: 2013-04-17
Time: 01:09

Re: Merging of Cells Vertically

Are you working on a DOCX template ?

A new feature has been added in OpenTBS 1.8.0 beta for merging cells vertically.

http://www.tinybutstrong.com/dl.php?f=tbs_plugin_opentbs_beta.zip&s=2

There is an example in the DOCX demo provided with this package.
By: Jayant
Date: 2013-04-17
Time: 06:09

Re: Merging of Cells Vertically

yes i am working with docx,xlsx and pdf templates. And i am using the same version for plugin.

Could you please guide me how could i do this task with above given formats.


Waiting for your kind response.

Thanks and Regards,
Jayant

By: Skrol29
Date: 2013-04-18
Time: 01:42

Re: Merging of Cells Vertically

The 'mergecell' operator works only with DOCX documents.
They are explanations the the documentation, and an example in the DOCX example provided with the demo in the OpenTBS package.

It is too complicate to merge cells dynamically in an XLSX for now.

I think OpenTBS cannot manage PDF templates.
By: Jayant
Date: 2013-04-18
Time: 06:12

Re: Merging of Cells Vertically

Thanks Skrol29,

For your reply.

I will do this and let you know and also i will try to figure out solution for xlsx and pdf template.
By: Jayant
Date: 2013-04-18
Time: 10:22

Re: Merging of Cells Vertically

Hey SKrol29,

Vertical cell merging is also not possible with .odt files.

Looking forward to hear from you.
By: Skrol29
Date: 2013-04-19
Time: 00:25

Re: Merging of Cells Vertically

Unfortunately it is to complicated to have the 'mergecell' feature for ODT, ODS and XLSX for now.
Sorry for that.
By: Edwin Stas
Date: 2014-10-01
Time: 14:20

Re: Merging of Cells Vertically FIXED

I know this is a DOCX topic but my fix works for ODS

Because I know how many rows I'm going to merge, I can make changes to the length of the vertical merged cells. I use this function in my class.
public function fix_vertical_cellMerge($rows) {
    $nrs=count($rows)+2;
    $res = array();
    $subres = array();
    $subres=array('number-rows-spanned'=>$nrs)+$subres;
    $res[] = $subres;
    return $res;
}
In the ODS file I have the vertical merged cell.
[ea31c.number-rows-spanned;att=table:table-cell#table:number-rows-spanned][onload.gasoline;strconv=no]
I call the function in my php script after the query.
$fxmc = $epPL->fix_vertical_cellMerge($rows);
$TBS->MergeBlock('ea31c', $fxmc);
Now comes the trick: You see in the code that I added the row count+2. This is because I have a row above and below the data row. This gives me the possibility to merge 3 cells. After the merge you can hide the 2 rows. This also makes it possible to draw borders around the merged cells (also use the cells that are not hidden for the borders)

I hope this can help some of you. Bye the way ... nice work SKrol29
By: Skrol29
Date: 2014-10-04
Time: 11:14

Re: Merging of Cells Vertically FIXED

Tanks for sharing this tip.