Search found 177 matches

by ms777
Sat Mar 23, 2024 1:23 pm
Forum: Macros and UNO API
Topic: Place image in Calc via macro
Replies: 4
Views: 869

Re: Place image in Calc via macro

Code: Select all

document = fiche
by ms777
Sat Feb 10, 2024 2:08 pm
Forum: Macros and UNO API
Topic: Draw: "Insert File" into file
Replies: 12
Views: 2693

Re: Draw: "Insert File" into file

5. The alternative approach didn't run for me.
XTransferableSupplier seems not to be implemented for Draw docs, see https://bugs.documentfoundation.org/sho ... ?id=151713
by ms777
Sat Jan 20, 2024 12:33 pm
Forum: Macros and UNO API
Topic: [Dropped] Avoid "is deprecated" warnings from xComponentLoader
Replies: 5
Views: 1847

Re: Avoid "is deprecated" warnings from xComponentLoader

to me it looks like a bug. Wanglong, can you create a minimum Java sample, which generates this error?
Do you work with 32bit or 64bit LO?
by ms777
Sat Jan 20, 2024 12:27 pm
Forum: External Programs
Topic: Java: Replace string in hidden document
Replies: 3
Views: 1747

Re: Java running UNO Basic script with documents in hidden mode

... just to be a bit more precise: Hidden documents do support the execution Basic scripts, but not dispatch calls
by ms777
Sat Nov 25, 2023 11:42 pm
Forum: Macros and UNO API
Topic: [Solved] Bootstrap Exception on IIS
Replies: 3
Views: 2249

Re: Bootstrap Exception on IIS

by ms777
Sat Aug 19, 2023 11:32 am
Forum: Code Snippets
Topic: Determining PDF Export Options
Replies: 2
Views: 3947

Re: Determining PDF Export Options

@JPL, thanks for the wiki page. I should do more thorough search before posting ... In an LO forum post https://ask.libreoffice.org/t/java-uno-implementation-of-whole-seet-export-for-calc-pdf-export/94613 , mikekaganski gave also this reference for LO pdf export options: https://help.libreoffice.org...
by ms777
Mon Aug 14, 2023 4:49 pm
Forum: Code Snippets
Topic: Determining PDF Export Options
Replies: 2
Views: 3947

Determining PDF Export Options

The PDF export options are not very well documented and difficult to find in the source code. The below macro calls the PDF dialog from a calc document and writes the options you set into the first sheet. The available export parameters are also listed for information for AO and LO. Sub GetFilterdat...
by ms777
Sun Jul 16, 2023 2:22 pm
Forum: Code Snippets
Topic: Use XML, XPATH to extract info from content.xml
Replies: 0
Views: 3394

Use XML, XPATH to extract info from content.xml

Hi, bitmaps stored in OO document can be extracted by unzipping the document. Their path is an internally given name. To find out which image belongs to which item in the document the below code snippet lists all images with their name and the path in the zip Good luck, ms777 Sub ListStoredImages oD...
by ms777
Fri Mar 03, 2023 8:08 pm
Forum: External Programs
Topic: [Solved] Load currently opened OO files [C#]
Replies: 19
Views: 5932

Re: Load currently opened OO files [C#]

Hi, one of the key questions here is if you use your c# program to start AO/LO, or if AO/LO is already started, when you launch your c# program. The former is relatively easy, the latter is quite difficult

P.S. Can you share some of the c# code which works for you?
by ms777
Sun Jan 22, 2023 12:57 pm
Forum: Macros and UNO API
Topic: [Solved] Print specific sheet on button click
Replies: 10
Views: 1788

Re: Print specific sheet on button click

Hi, I am pretty sure that this is not easily achievable as neither https://www.openoffice.org/api/docs/common/ref/com/sun/star/view/PrintOptions.html nor https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Printing_Spreadsheet_Documents#Printer_and_Print_Job_Settings nor the dialog ...
by ms777
Sun Jan 22, 2023 12:45 pm
Forum: Macros and UNO API
Topic: [Solved] Access to LibreOffice expert configuration
Replies: 8
Views: 1556

Re: Access to LibreOffice expert configuration

I don't understand what's the point : aSettings.setHierarchicalPropertyValue(sNodePath & "/Size", "384,53") ... that was just a hint how to set a configuration value. I was setting some window size parameter. But your way aSettings.getByname("WriterInsertImage").La...
by ms777
Tue Jan 17, 2023 7:19 pm
Forum: Macros and UNO API
Topic: [Solved] Access to LibreOffice expert configuration
Replies: 8
Views: 1556

Re: Access to LibreOffice expert configuration

Hi, below some code to change configuration settings as a starter. In my configuration there was no "WriterInsertImage" setting. Maybe you have to create that setting from scratch. Good luck, ms777 Sub Main sNodePath = "org.openoffice.Office.Common/Misc/FilePickerLastDirectory" D...
by ms777
Mon Jan 02, 2023 9:25 am
Forum: Macros and UNO API
Topic: [Dropped] Convert pixel positions to cell referencess
Replies: 4
Views: 998

Re: Conversion Of Positions Given as Pixel Into Cells

Hi, parsing pdf into a senseful document format is highly nontrivial. I have made very good experience with the Extract Text function of PDFBOX https://pdfbox.apache.org/ and iText7 https://itextpdf.com/products/itext-7 (license required for commercial application). The former is Java, so it should ...
by ms777
Wed Dec 28, 2022 2:04 pm
Forum: Macros and UNO API
Topic: Script provider loads document python macros too late?
Replies: 9
Views: 3545

Re: Script provider loads document python macros too late?

P5 means that it will never be solved, I suppose. If you don't comment and vote for the issue, you suppose correctly. I added a comment. I did not find a voting button, though. I discovered some strange behavior: If you take the attached LibreOrApache.ods, select all cells, right click on the row h...
by ms777
Thu Dec 22, 2022 9:15 pm
Forum: Macros and UNO API
Topic: Script provider loads document python macros too late?
Replies: 9
Views: 3545

Re: Script provider loads document python macros too late?

Hi,

thanks for the workaround. I am more interested to understand why the formula does not work on first call, and if this is an LO/AO bug or programmer stupidity :-)

I have not coupled the macro to any event. It is just referenced by the user defined function call in A1

ms777
by ms777
Thu Dec 22, 2022 6:41 pm
Forum: Macros and UNO API
Topic: Script provider loads document python macros too late?
Replies: 9
Views: 3545

Re: Script provider loads document python macros too late?

... thanks for the pointer to the AO bug. P5 means that it will never be solved, I suppose. In LO, things are a bit more complex: if I store the python in user, not document, and call by ' oScriptProvider = ThisComponent.getScriptProvider() oScriptProvider = CreateUNOService("com.sun.star.scrip...
by ms777
Thu Dec 22, 2022 4:26 pm
Forum: Macros and UNO API
Topic: Script provider loads document python macros too late?
Replies: 9
Views: 3545

Script provider loads document python macros too late?

Hi, I am trying to use python macros as cell functions with Basic wrappers. My python function, stored in the document (returns the working directory): import os def getWorkingDirectory(): return os.getcwd() g_exportedScripts = (getWorkingDirectory,) My Basic wrapper: function getWorkingDirectory() ...
by ms777
Tue Dec 20, 2022 8:43 pm
Forum: External Programs
Topic: [Solved] Am I using LibreOffice or OpenOffice API?
Replies: 19
Views: 8078

Re: Am I using LibreOffice or OpenOffice API?

Hi, So is there a way to programmatically control LibreOffice when both are installed? translated to: Can you specify to call either AO or LO from external programs? My 90% confindence answer: With python: yes Using Windows ActiveX Objects: no The code (I use powershell, C# is very similar) for the ...
by ms777
Fri Nov 25, 2022 12:03 am
Forum: Macros and UNO API
Topic: Running User Stored Procedure (SQL server) from Calc code
Replies: 5
Views: 3771

Re: Running User Stored Procedure (SQL server) from Calc code

... not sure if this is of any help, because it is on MariaDB and uses the sdbc:mysql:jdbc driver In MariaDB I create a stored procedure by delimiter ;; create or replace procedure foo(param1 int UNSIGNED, param2 CHAR(10)) contains sql begin select param1, param2; end;; delimiter ; This is the code ...
by ms777
Sat Nov 12, 2022 2:01 pm
Forum: Macros and UNO API
Topic: [Solved] Evenly distribute text to columns
Replies: 8
Views: 930

Re: API: columns: evenly distribute text issue

... try the below code. The first one requires the cursor being in the multi column section Good luck ms777 Sub Main oDoc = ThisComponent oSection = oDoc.currentSelection.getByIndex(0).TextSection oSection.DontBalanceTextColumns = not oSection.DontBalanceTextColumns msgbox oSection.DontBalanceTextCo...
by ms777
Sun Oct 30, 2022 9:17 am
Forum: Macros and UNO API
Topic: [Solved] Calc line chart missing category / x-axis values
Replies: 2
Views: 665

Re: Calc line chart missing category / x-axis values

Hi,

to add the axis descriptions you have to add a line

Code: Select all

oData.setRowDescriptions(oDataXValuesArray)
Good luck,

ms777
by ms777
Sat Oct 22, 2022 12:34 pm
Forum: External Programs
Topic: [Solved] Avoid SAXException dialog with OLE pywin32
Replies: 3
Views: 3336

Re: How to skip SAXException Dialog with OLE pywin32

Hi, the MediaDescriptor passed to the loadComponentFrom Url function allows to specify an XInterActionHandler https://www.openoffice.org/api/docs/common/ref/com/sun/star/document/MediaDescriptor.html#InteractionHandler . Unfortunately, this handler is not called for SAXExceptions. You probably can g...
by ms777
Tue Sep 27, 2022 11:23 am
Forum: Macros and UNO API
Topic: [Solved] Export to .JPG file does not consider image quality
Replies: 4
Views: 7928

Re: Export to .JPG file does not consider image quality

... that was a tough one ... There were two issues with your code. (i) PixelWidth/PixelHeight is way too large for the GraphicExporter, and (ii) you have to do some forced type conversion when passing the FilterData. See the comments in the code Good luck, ms777 import uno import sys import time imp...
by ms777
Mon Sep 26, 2022 5:03 pm
Forum: Macros and UNO API
Topic: [Solved] Export to .JPG file does not consider image quality
Replies: 4
Views: 7928

Re: Export to .JPG file does not consider image quality

Please post the code you are using
by ms777
Sat Sep 24, 2022 12:40 pm
Forum: Code Snippets
Topic: Write own Toolbars in Python
Replies: 3
Views: 3739

Re: Write own Toolbars in Python

... an update: The below code runs both on LO Win10 64 bit and on AO. If you start from outside LO, you have to modify the Popen line Now the Toolbar can be switched on and off through the Show Toolbars Menu. On LO, there are still some redraw issues Good luck, ms777 import uno import unohelper from...
by ms777
Sun Sep 04, 2022 3:50 pm
Forum: Code Snippets
Topic: Write own Toolbars in Python
Replies: 3
Views: 3739

Re: Write own Toolbars in Python

... the above code is for AO only. LO uses a more up to date Python version. Python seems not to be fully compatible. The below code runs on LO 7.4.0.3 on Win 10 / x64. Some issues: When run from VS Code, an LO process remains alive, which you have to kill manually. Sometimes, you see some black are...
by ms777
Sun Sep 04, 2022 11:10 am
Forum: Code Snippets
Topic: Write own Toolbars in Python
Replies: 3
Views: 3739

Write own Toolbars in Python

Hi all, the code below allows you do insert custom designed items into the toolbar. As an example, it inserts two selection boxes and one slider into the toolbar. This is a rework of some beanshell / basic code in the old forum. If you are interested in the old code, KamiKanda attached it to a post ...
by ms777
Sat Sep 03, 2022 10:32 am
Forum: Macros and UNO API
Topic: [Solved] Help translate Basic to Python
Replies: 1
Views: 560

Re: Help translate Basic to Python

... i found the solution myself in https://ask.libreoffice.org/t/pyuno-ill ... tion/54089:

Code: Select all

uno.invoke( oToolbarSettings, "insertByIndex", (0, uno.Any("[]com.sun.star.beans.PropertyValue", aprop)))
by ms777
Sat Sep 03, 2022 10:12 am
Forum: Macros and UNO API
Topic: [Solved] Help translate Basic to Python
Replies: 1
Views: 560

[Solved] Help translate Basic to Python

Hi, I am trying to generate a ToolbarItem in calc. The Basic code (just copied the relevant lines) works without problem. The python code throws an "Type must be com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >" exception. Can somebody help? Cheers ms777 The Basic code...
by ms777
Tue Aug 23, 2022 10:18 pm
Forum: Macros and UNO API
Topic: [Solved] Testing StarBasic Sort Algorithms with Calc cells
Replies: 8
Views: 3335

Re: Testing StarBasic Sort Algorithms

you have to call

Code: Select all

InsertionSort(oArray.Data(0))
Data is a 2-dimensional array