You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/10/15 22:37:06 UTC

DO NOT REPLY [Bug 46015] New: simpler usage for HSSFCellStyle?

https://issues.apache.org/bugzilla/show_bug.cgi?id=46015

           Summary: simpler usage for HSSFCellStyle?
           Product: POI
           Version: 3.1
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: ryampolsky@yahoo.com


Just a suggestion...

It seems like the HSSFStyle API is designed more around the internals of the
xls file format than around what a programmer would want to do when building a
spreadsheet.

For example, I've been trying to figure out how to manage the global list of
HSSFCellStyles and reuse existing ones where possible.  It seems like the
easiest way to do this would be to build a reference style with all the
settings you want for a particular cell and then enumerate over all the
existing styles in the workbook to see if there's a match.

If so, would it not make sense to add the following methods to the HSSFCell
class to automate that procedure and hide it from the user:

HSSFCellStyle getNewStyle();

Produce a temporary HSSFCellStyle, where you could set all the parameters you
want, without attaching it to the workbook.

void applyNewStyle(HSSFCellStyle style);

Scan all the styles in the workbook and if there's a match, apply the existing
style to the cell.  If not, attach the new style to the workbook and apply it
to the cell.

It certainly seems like that's what Excel does when you restyle a cell.  It
certainly does not just apply the change to a global style that the cell shares
with others, in applying the change to all the shared cells.

Does this sound reasonable?  I'd submit a patch if I understood the POI
codebase better.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46015] simpler usage for HSSFCellStyle?

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46015





--- Comment #2 from littlenoodles <ry...@yahoo.com>  2008-10-16 08:58:52 PST ---
Yeah, the approach you outlined is essentially how I thought I'd do it for my
app.  I had just noticed that I wasn't alone in this confusion and had thought
that it would be nice if the project either provided this guidance in the
documentation or, even better, wrapped this behavior into a standard interface
that would make cell styles much easier to use for most applications.

This is my first Java project, so I don't feel qualified to submit a patch
(yet).  I was hoping that bugzilla might be a semi-appropriate place to make
suggestions.  If not, is there a better place to submit it?  And is my
suggestion just wrong-headed in terms of the goals of the project?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46015] simpler usage for HSSFCellStyle?

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46015


Nick Burch <ni...@torchbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




--- Comment #1 from Nick Burch <ni...@torchbox.com>  2008-10-16 07:45:53 PST ---
You can probably already do most of this, with a little bit of fiddling.
HSSFCellStyle.cloneStyleFrom(style), HSSFWorkbook.getNumCellStyles() and
HSSFWorkbook.getCellStyleAt(idx) should be most of what you need

If you do wrap this up in an easier to use structure for your use case, do
please submit a patch


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 46015] simpler usage for HSSFCellStyle?

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46015





--- Comment #3 from Nick Burch <ni...@torchbox.com>  2008-10-16 09:50:08 PST ---
(In reply to comment #2)
> I had just noticed that I wasn't alone in this confusion and had thought
> that it would be nice if the project either provided this guidance in the
> documentation or, even better, wrapped this behavior into a standard interface
> that would make cell styles much easier to use for most applications.

Being an open source, volunteer project, the available features and
documentation track what people are willing and able to contribute

If you'd like to write the code for this, we'd be happy to accept it. If you
just want to document the workaround, we'd again be happy to add that to the
overall docs :)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org