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 2011/09/22 18:09:11 UTC

DO NOT REPLY [Bug 51870] New: Allow HSSFSheet to query existing DataValidation settings [with patch]

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

             Bug #: 51870
           Summary: Allow HSSFSheet to query existing DataValidation
                    settings [with patch]
           Product: POI
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: hannes@erven.at
    Classification: Unclassified


Created attachment 27567
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27567
Patch.

I need to detect whether a given HSSFSheet already has DataValidation settings
applied.
The DataValidityTable class already has a visitContainedRecords(RecordVisitor)
method, that is currently inaccessible from both HSSFSheet and user code.

The following patch suggests to add a method 

public void visitValidationData(RecordVisitor rv)

to HSSFSheet to iterate through the DataValidation records.
Use it like this:

final RecordVisitor rv = new RecordVisitor() {
  @Override
  public void visitRecord(Record r) {
    if (r instanceof DVRecord){
      final DVRecord dr = (DVRecord) r;
      // So there's the validation
      if (dr.getDataType() == ValidationType.LIST){
           // There is a DROP DOWN list! Use dr.* to examine location and
content.
      }
    }
  }
};
sheet.visitValidationData(rv);



The XSSFSheet already provides a getDataValidations() method,

-- 
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


[Bug 51870] [PATCH] Allow HSSFSheet to query existing DataValidation settings

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

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Allow HSSFSheet to query    |[PATCH] Allow HSSFSheet to
                   |existing DataValidation     |query existing
                   |settings [with patch]       |DataValidation settings

-- 
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


[Bug 51870] [PATCH] Allow HSSFSheet to query existing DataValidation settings

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

Yoann Rodière <yo...@openwide.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yoann.rodiere@openwide.fr

-- 
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


[Bug 51870] [PATCH] Allow HSSFSheet to query existing DataValidation settings

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

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> ---
Unfortunately the path in its current form cannot be applied.

HSSF does not expose classes for internal use: there are no getters that return
record.* or model.* objects, these are hidden and it is by design. 

Think about implementing getDataValidations() in HSSFSheet. That would be cool
and this method will go to the interface:

In the Sheet interface we will have  List<DataValidation> getDataValidations() 

and two implementations:

 List<HSSHDataValidation> getDataValidations()  
 List<XSSFDataValidation> getDataValidations() 

Regards,
Yegor

-- 
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