Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clone column #1133

Open
cataragak90 opened this issue Sep 6, 2017 · 2 comments
Open

clone column #1133

cataragak90 opened this issue Sep 6, 2017 · 2 comments

Comments

@cataragak90
Copy link

cataragak90 commented Sep 6, 2017

is it possible to clone a column for a table, like the "cloneRow" function works?
thanks


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@FBnil
Copy link

FBnil commented Oct 3, 2017

It is not in the code at the moment. The capture of w:tc is not that hard to implement, I'll explain:
Create your table, and add a long word you can search for later inside the cell you want to split. Now unzip your docx file, and search for the document.xml. Open it with an editor (atom, notepad++) that can make XML somewhat visible. Now search for your searchtext. You will see something like this (I added newlines to make it more readable, but you should keep it in one line):

THISISCELL1</w:t></w:r></w:p></w:tc>
<w:tc><w:tcPr>
:
:
<w:r><w:rPr></w:rPr>
<w:t>THISISCELL2

Basically: THISISCELL1</w:t>....<w:t>THISISCELL2

So your separation element is one long line: $separation = "</w:t>....<w:t>", which you can use to setValue() like this:
setValue('THISISCELL1', 'first' . $separation . 'second');

This will add only a new cell to a table row, so you need to do this for each row.

@AdeSupriyadi
Copy link

@FBnil Could You give us sample code? I need clone column to generate word from template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants