Categories > OpenTBS with XLSX >

Hide or Delete Column in XLSX?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: John Lawler
Date: 2013-08-03
Time: 00:39

Hide or Delete Column in XLSX?

Hi, I've spent a little time browsing the documentation, but don't see any specific example or mention of how to do this, if possible with OpenTBS.

I see there are some options for deleting columns in Word tables, but not Excel.

I see how I can *add* columns in some situations, but is there not a simple way to either completely delete a column from a template (when a certain version of my output doesn't need it and I'd rather not have to define a whole separate template for that purpose) or do an Excel "hide" on that column so it won't normally display or print?
By: Skrol29
Date: 2013-08-21
Time: 00:39

Re: Hide or Delete Column in XLSX?

Hi John,

There is no simple way to delete a column in a spreadsheet for now.
This is because in a spreadsheet, each row may or may not have the expected column.

But it could be interesting to have such a feature.
By: John Lawler
Date: 2013-08-21
Time: 17:46

Re: Hide or Delete Column in XLSX?

Hi Skrol, I'm guessing you just got back from your holiday, based on your unusually long reply time.  If so, I hope you enjoyed your time off.

Yes, deleting the column, or, as I mentioned, just doing the equivalent of an Excel "hide" on a column would be helpful for me in some situations (basically, it would allow me to have a single XLSX TBS template instead of multiple ones for different situations).

It looks like in the XLSX "sheet1.xml" file in a tiny test I did, possibly all you need is a section like this to indicate column A is hidden:

<cols>
<col min="1" max="1" width="0" hidden="1" customWidth="1" />
</cols>

so for my purposes, if I could just embed some TBS code somewhere in the template that can check a global variable, probably known before any individual detail (or block) processing is done, and have TBS just hide certain column numbers.  I guess the most flexible option would be to hide any columns at any point before the XLSX is actually complete and outputted.

Thanks
By: Skrol29
Date: 2013-08-25
Time: 23:21

Re: Hide or Delete Column in XLSX?

Hi,

Indeed, I was on holidays :-)

For now OpenTBS cannot manage this section for you.
But you can easily manage the section yourself.
The XML source is accessible using $TBS->Source.
Thus you can check if the entity exist, or add it before <sheetData>, and then arrange it as you wish.
By: John Lawler
Date: 2013-08-26
Time: 02:06

Re: Hide or Delete Column in XLSX?

Thanks for pointing that out.  I think I was aware of that at one point, but had forgotten.  I might go that route next time I have this issue come up.