Hiding cell values via WriteExcel module

D

dn.perl

A quick search of the forum's archives shows that there might be a way
to hide a cell in an excel sheet via win32::eek:le module.
http://groups.google.com/group/comp...d?lnk=gst&q=excel+hidden+ole#7943a11cad6139dd

Excel's help for the topic 'Hide or display cell values' suggests that
if a cell's format is set to Number > Custom, and the type is set
to ;;; (three semi-colons), the field is shown blank on the sheet but
the correct value remains associated with the cell. Can this hiding of
the data for a cell or an entire row or an entire column be achieved
through WriteExcel module?

Even if I could *actually* set a column's width to 0 via WriteExcel
module, it would do.
But if I use: set_column('B:B', 0) ; the column B's width is set to
some non-zero default value which Excel seems to calculate internally.

TIA.
 
S

smallpond

Excel's help for the topic 'Hide or display cell values' suggests that
if a cell's format is set to Number > Custom, and the type is set
to ;;; (three semi-colons), the field is shown blank on the sheet but
the correct value remains associated with the cell. Can this hiding of
the data for a cell or an entire row or an entire column be achieved
through WriteExcel module?

Have you tried it?
$hide_cell = set_num_format(';;;');
$worksheet->write(0, 0, 3.1415926, $hide_cell);
 
J

Jim Gibson

A quick search of the forum's archives shows that there might be a way
to hide a cell in an excel sheet via win32::eek:le module. [...]

Even if I could *actually* set a column's width to 0 via WriteExcel
module, it would do.
But if I use: set_column('B:B', 0) ; the column B's width is set to
some non-zero default value which Excel seems to calculate internally.

The version of Spreadsheet::WriteExcel on my system (2.25) has a hidden
attribute in the set_column method:

set_column($first_col, $last_col, $width, $format, $hidden, $level,
$collapsed)

with examples:

$worksheet->set_column('D:D', 20, $format, 1);
$worksheet->set_column('E:E', undef, undef, 1);

Have you tried that?
 
S

smallpond

A quick search of the forum's archives shows that there might be a way
to hide a cell in an excel sheet via win32::eek:le module. [...]

Even if I could *actually* set a column's width to 0 via WriteExcel
module, it would do.
But if I use: set_column('B:B', 0) ; the column B's width is set to
some non-zero default value which Excel seems to calculate internally.

The version of Spreadsheet::WriteExcel on my system (2.25) has a hidden
attribute in the set_column method:

set_column($first_col, $last_col, $width, $format, $hidden, $level,
$collapsed)

with examples:

$worksheet->set_column('D:D', 20, $format, 1);
$worksheet->set_column('E:E', undef, undef, 1);

Have you tried that?

I think that is for hiding formulas rather than values.
 
J

Jim Gibson

smallpond said:
I think that is for hiding formulas rather than values.

It is for setting default values for columns. From the documentation:

"The $hidden parameter should be set to 1 if you wish to hide a column.
This can be used, for example, to hide intermediary steps in a
complicated calculation:"

Followed by the above examples.
 
S

smallpond

It is for setting default values for columns. From the documentation:

"The $hidden parameter should be set to 1 if you wish to hide a column.
This can be used, for example, to hide intermediary steps in a
complicated calculation:"

Followed by the above examples.

Sorry. I thought set_column was applying the hidden property to
cells in the column, but it is actually hiding the whole column.
Too many uses of "hidden" in that program.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top