[Libreoffice] [PUSHED] How to create get an XWorksheet from a XSpreadsheet?

Noel Power nopower at novell.com
Mon Apr 18 03:00:13 PDT 2011


On 17/04/11 02:02, Markus Mohrhard wrote:
> Hello Noel,
>
> I have found the reason why setUpDocumentModules won't work correctly 
> with the new method. It seems that the method will only work when the 
> name and the code name of a ScTable are the same.
ah ok that makes sense, setUpDocumentModules when called in the context 
of a new document has the default sheet names and the default codenames 
are the same, in this case the codename hasn't been set. Thanks for 
debugging that
> There was also a little bug in ScVbaWorksheets::Copy. You removed one 
> loop but the second loop must start with the second element if a new 
> document was created.
> With a document with Sheet1, Sheet2, Sheet3 and the VBA code 
> Sheets.Copy something like this was produced in the new document:
>
> Sheet1, Sheet1_2, Sheet2, Sheet3
hmm that was bad, I tested this but seems I just didn't see the extra 
sheet :-( thanks for fixing that
>
> There are still some bugs in ScVbaWorksheet[s]::Copy, but it seems 
> that they were not introduced with my last patch. References in the 
> copied sheets fail under some circumstances. I'll have a look at these 
> cases.
Also when sheets are copied the associated code modules should also be 
copied so... it seems that setUpDocumentModules might not exactly  be 
what we want in this case so we probably want this method to do a little 
more ( but that is another task, I think it is acceptable that new code 
doesn't have to do everything first go ) Normal worksheet(s).copy ( into 
the same document ) does copy the associated code module.
Becareful testing these scenarios when running some copy macros like ( 
Worksheets.Copy before:=Worksheets(1) ) from the LibreOffice IDE as I 
notice that when you do that the macro tabs seem to get either 
completely screwed up ( and you need to close and re-open the IDE ) or 
the new Modules don't appear ( again if you close/open the IDE you will 
see them ) This is quite annoying as this used to work ( in the go-oo 
days ) and so is a  regression.

So.. the patch as far as I can see looks good, I will do some quick 
testing and push it if all is ok, supporting the copy of the associated 
code modules ( when copying into a new document  ) is something to think 
about later if you are interesting in that too.
thanks again
Noel


More information about the LibreOffice mailing list