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 2006/04/12 09:40:09 UTC

DO NOT REPLY [Bug 39234] - POIFS saved file cab cause VBA "File not found" error and corrupts XLS

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39234>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39234


bill.seddon@lyquidity.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|POIFS saved file causes VBA |POIFS saved file cab cause
                   |"File not found" error and  |VBA "File not found" error
                   |corrupts XLS                |and corrupts XLS




------- Additional Comments From bill.seddon@lyquidity.com  2006-04-12 08:39 -------
As a follow up, I discovered that the list of VBA streams generated by Excel 
can include ones with names like __SRP_0 or __SRP_2.  Like the _VBA_PROJECT 
stream, these cannot be sorted alphabetically.  Instead the "underscore" 
streams seem to have to be sorted separately and made to appear *after* all 
other streams giving this kind of structure:

_VBA_PROJECT_CUR
----PROJECT
----PROJECTwm
----VBA
--------dir
--------Module1
--------Sheet1
--------ThisWorkbook
--------__SRP_0
--------__SRP_1
--------_VBA_PROJECT

What would happen to a file with three leading underscores, I don't know.

Anyway, here is my updated code for the comparator method:

public int compare(Object o1, Object o2)
{
  String VBA_PROJECT = "_VBA_PROJECT";
  String name1  = (( Property ) o1).getName();
  String name2  = (( Property ) o2).getName();
  int  result = name1.length() - name2.length();

  if (result == 0)
  {
    // _VBA_PROJECT, it seems, will always come last
    if (name1.compareTo(VBA_PROJECT) == 0)
      result = 1; 
    else if (name2.compareTo(VBA_PROJECT) == 0)
      result = -1;
    else
    {
      if (name1.startsWith("__") && name2.startsWith("__"))
      {
        // Betweeen __SRP_0 and __SRP_1 just sort as normal
        result = name1.compareToIgnoreCase(name2);
      }
      else if (name1.startsWith("__"))
      {
        // If only name1 is __XXX then this will be placed after name2
        result = 1; 
      }
      else if (name2.startsWith("__"))
      {
        // If only name2 is __XXX then this will be placed after name1
        result = -1;
      }
      else
        // result = name1.compareTo(name2);
        // The default case is to sort names ignoring case
        result = name1.compareToIgnoreCase(name2);
    }
  }
  return result;
}


  

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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/