To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=66254


User guiris changed the following:

                  What    |Old value                 |New value
================================================================================
                    Status|RESOLVED                  |UNCONFIRMED
--------------------------------------------------------------------------------
                Resolution|WONTFIX                   |
--------------------------------------------------------------------------------




------- Additional comments from [EMAIL PROTECTED] Fri Jun  9 04:48:00 -0700 
2006 -------
The problem is the same whit version 2.0 My code is: I find text in a sheet 
whit a regular expresion patron

private void generateDocumentExcel(XComponent xComponent,ITagTranslator 
tagtranslator)
        throws ISPACException
        {
        XReplaceable xReplaceable = null;
        XReplaceDescriptor xReplaceDescriptor = null;
                XIndexAccess xIndexAccess_ = null;
                XSpreadsheetDocument xDocument = (XSpreadsheetDocument)
UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
                //CARGAMOS LA COLECCION DE HOJAS DEL LIBRO      
                com.sun.star.sheet.XSpreadsheets xSheets = xDocument.getSheets
();
                com.sun.star.sheet.XSpreadsheet xSheet= null; 
                String[] names = xSheets.getElementNames();
        xIndexAccess_ = (XIndexAccess)UnoRuntime.queryInterface
(XIndexAccess.class, xSheets );
        //ACCEDEMOS A CADA UNA DE LAS HOJAS PARA BUSCAR LOS TAGS DECLARADOS Y 
SUSTITUIRLOS POR SU VALOR
        for (int x = 0; x < xIndexAccess_.getCount(); x++){
                try {
                        xSheet = (XSpreadsheet) UnoRuntime.queryInterface
(XSpreadsheet.class, xIndexAccess_.getByIndex(x));
                } catch (IndexOutOfBoundsException e1) {
                                e1.printStackTrace();
                } catch (WrappedTargetException e1) {
                                e1.printStackTrace();
                } 
                        //cargamos todas la celdas de la hoja 
                        com.sun.star.table.XCellRange xCellRange = 
xSheet.getCellRangeByName("A1:IV32000");
                        xReplaceable = (XReplaceable) UnoRuntime.queryInterface
( XReplaceable.class, xCellRange);
                        // Descriptor to set properies for replace
                        xReplaceDescriptor = (XReplaceDescriptor) 
xReplaceable.createReplaceDescriptor();
                        xReplaceDescriptor.setSearchString(ISPACTAG);
//private static final String ISPACTAG="<[ \\t\\n\\x0B\\f\\r]*ispactag[ 
\\t\\n\\x0B\\f\\r]+[^(/>)]*/>";
                        Object object = new Boolean(true);
                        
                        try
                                        {
                                        xReplaceDescriptor.setPropertyValue
("SearchRegularExpression", object);
                                        }catch(Exception e)
                                        {
                                                throw new ISPACException(e);
                                        }
                                XIndexAccess xIndexAccess = null;
                                XTextRange xTextRange = null;
                                
                                String strTag = null;
                                String strValue = null;
                                Object tag;
                                
                                // Busca todos los tags declarados en el 
documento
                                 
                                
                                xIndexAccess = xReplaceable.findAll
(xReplaceDescriptor);
                                
                                
                                
                                
                                ArrayList tagslist = new ArrayList();
                                //Comprobamos que hay Tags declarados en la 
hoja activa antes de recorrerla
                                if (xIndexAccess!=null){

                                        for (int i = 0; i < 
xIndexAccess.getCount(); i++)
                                                {
                                                        try
                                                        {
                                                        
                                                        tag = 
xIndexAccess.getByIndex(i);
                                                        }catch(Exception e)
                                                        {
                                                                throw new 
ISPACException(e);
                                                        }

                                                    xTextRange = (XTextRange) 
UnoRuntime.queryInterface(XTextRange.class,tag);
                                                        
                                                        
                                                        
                                                        strTag = 
xTextRange.getString();
                                                        if (strTag!=null)
                                                        tagslist.add(strTag);
                                                }

                                                List translatedtags = 
tagtranslator.translateTags(tagslist);

                                                object = new Boolean(false);
                                        try
                                        {
                                        
        xReplaceDescriptor.setPropertyValue("SearchRegularExpression", object);
                                        }catch(Exception e)
                                        {
                                                throw new ISPACException(e);
                                        }

                                                // Los dos conjuntos estan 
ordenados.
                                        Iterator it = tagslist.iterator();
                                        Iterator ittranslated = 
translatedtags.iterator();

                                        while (ittranslated.hasNext()
&&it.hasNext())
                                                {

                                                String stagvalue =(String) 
ittranslated.next();
                                                if (stagvalue==null)
                                                        stagvalue="";

                                        
        xReplaceDescriptor.setSearchString((String) it.next());
                                        
        xReplaceDescriptor.setReplaceString(stagvalue);
                                                xReplaceable.replaceAll
(xReplaceDescriptor);
                                                }
                                }//fin de if que comprobueba que hay tags 
declarados
       } //final del recorrido de todas las hojas del libro (primer for abierto 
en la funcion)
     
}//FIN FUNCION generateDocumentExcel

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to