Created attachment 56899 [details] Source Text of macro Within the PDF Export function there is an ability to set required filter options such as exporting bookmarks, initial view etc. These can be set interactively in the associated dialog box. They should also be able to be set from a basic macro by setting them in an array argument to the calc_pdf_Export function to override the current default settings. This does not happen and the previous defaults are used. I wished to ensure I created a PDF of a workbook with 3 sheets showing bookmarks, I ran this interactively setting export bookmarks on dialog box. I then recorded macro running export 3 times switching off then on then off the setting which worked fine. When I rerun the macro the output remains constant - ignoring the settings. I have tried this with writer as well, and on both XP and Windows7. I have also written .net program calling the pdf_export routine and the problem is constant. I believe this is major since one can't automate production of documents to ensure required layout is created. I attach sample listing of the macro. To test create a workbook which has 3 sheets, create a PDF from the dialog with bookmarks off, rerun with bookmarks on, the output file reflects the change. Run the main macro which should create 3 pdf's in c:\work to show bookmarks being absent, present and then absent, all 3 have bookmarks.
Thanks for bugreport. in attached file I see this: Array("ExportBookmarksToPDFDestination",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE) repeated 3 times. Try change this somehow, my be it will begin to work properly. PS: "record macro" is experimental function, do not expect that it will work properly in near future. Write or edit Basic programs manually meanwhile.
Sasha Thanks for response. The key to the three lines was that the parameter ExportBookmarks was set alternately to remove impact of default settings.I have simplified code to just use ExportBookmarks and ExportBookmarksToPDFDestination parameters and tried combinations of true and false, problem still remains. I dont think that the 2nd param is relevant as according to description of parameters this requests bookmark to be a "named destination" which appears to mean that it can be included in commandline to open document at the specified location, the normal bookmark option allows navigation from open document. I note your comment about the staus of record macro but I believe basic code used is correct and as I said I also had problems using the calls from a vb.net program. This seems to been a bug in the previous OO releases Regards Colin
Thanks for additional testing @ Noel Please, take look at this bug when will have time. Something with Basic function is wrong
(In reply to comment #3) > Thanks for additional testing > > @ Noel > Please, take look at this bug when will have time. Something with Basic > function is wrong this is a recorded macro right? if so then I think you are on your own, recorded macros ( or junk as I call them ) are unreliable and basically a bad idea and that's why the ability to record marcos was changed to be an experimental feature.
Thanks for reply After second look at attached file I found this: Array("ExportBookmarks",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE) in first call to pdf export, then Array("ExportBookmarks",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE) in second call, then again the same as in first. We see that in 1-th and 3-th call parameter is set to false and in 2-th to true. IMHO Macro Recorder recorded in this case right. Problem with parameter. Function ExportToPDF not takes it in account. @ colin.vaughanxx exist examples of code on Java how use exporting, may be useful: http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export http://andreasmaooo.blogger.de/topics/OOoPDFConverter/ Also try search among OpenOffice and LibreOffice extension for exporting to PDF. If such extension exist (where we can set options for exporting), try find inside of Basic script inside of extension, how this done
Sasha, thanks for the links, I had used the wiki pages to determine which parameters were needed and based my calls on that. Unfortunately I'm not Java but used the examples as basis for the vb.net and macros. I have now found an open source library for .Net I can create my doc with. I will still try and work out the office problem nut now for interest. Thanks for your help Colin
(In reply to comment #4) > this is a recorded macro right? Not the lines that have the problem
(In reply to comment #7) > (In reply to comment #4) > > > this is a recorded macro right? > > Not the lines that have the problem eh? what lines do you mean? ( afaics all the code in the attachment is macro-recorder generated junk )
Is this still an UNCONFIRMED bug? Is this just a macro that isn't written properly or a problem with LO? If it's confirmed can we mark as NEW, if not, can we close it as NOTABUG and just keep the dialog open for those who want to help colin try to figure it out. Thanks all
I think this bug is in ALL versions of LibreOffice and OpenOffice. Few days ago I created new bug in category "Printing and PDF export". Sorry for that. You can look at it on https://www.libreoffice.org/bugzilla/show_bug.cgi?id=65549 or read description here... I am new here. Can I mark this bug as "NEW" or someone else will do it? Problem description: I want export as PDF part of the Calc document through the recorded macro. I recorded a macro. It is OK. But if I run it, the macro ignore property Range ("Selection") from PDF Options window. This property is saved in the macro code: ... Array("Selection",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE) ... Steps to reproduce: 1. Fill some cells with any data. 2. Start record macro. 3. Select some cells (not all). 4. File/Export as PDF. 5. Select "Selection" in Range setting on General tab. 6. "Export" and choose the destination. 7. Stop record macro and save it. 8. Check created document - it should be OK - only selected cells has been exported. 9. Run the macro. 10. Check created document - whole document has been exported. I tested it in Ubuntu LibreOffice version 3.5.7.2 (Calc and Writer), Windows Xp LibreOffice 4.0.1.2 (Calc), 4.1.0.0beta1 (Calc) and in some version of OpenOffice (Calc). All tested versions contain this bug. Operating System: All
(In reply to comment #8) > eh? what lines do you mean? ( afaics all the code in the attachment is > macro-recorder generated junk ) I thought that the lines with the values for agrs(n) were not recorded, but that was my mistake. Sorry.
@noel, > afaics all the code in the attachment is macro-recorder generated junk still one could expect that if a filtername is properly passed as argument to the dispatcher, that something should be done with it . (lacking time to test on this currently, sorry)
I am closing this bug as Noel is our resident expert here and he has diagnosed the problem - it's with recording macros (which we know is a problem and we're dealing with it slowly). That being said I highly recommend going to the user list to learn how to really write the macro without relying on poor recording feature. Note that I am closing this as INVALID - just because it is a bug that is a meta bug (of what we already know, the recording feature needs help).