Bug 114312 - UNO services for Document Settings absent from API
Summary: UNO services for Document Settings absent from API
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
5.4.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks:
 
Reported: 2017-12-07 14:29 UTC by Fernando Volquind
Modified: 2023-07-30 07:41 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fernando Volquind 2017-12-07 14:29:54 UTC
Description:
Using Java API, I am trying to change a Writer document setting (EmbedFonts). There is no reference to either com.sun.star.document.Settings or com.sun.star.tex.DocumentSettings on the API, although they can be found on the online JavaDocs.
Using XMultiServiceFactory.createInstance returns a null object.
I tried the MRI extension, and the service is no listed there either.

Steps to Reproduce:
1- Bootstrap LibreOffice from the Java API, load a document.
2- Using a XMultiServiceFactory object, try to call xMSF.createInstance("com.sun.star.tex.DocumentSettings");

Actual Results:  
Call returns null.

Expected Results:
Call should return a DocumentSettings object.


Reproducible: Always


User Profile Reset: No



Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Comment 1 Maxim Monastirsky 2017-12-18 15:54:35 UTC
(In reply to Fernando Volquind from comment #0)
> 2- Using a XMultiServiceFactory object, try to call
> xMSF.createInstance("com.sun.star.tex.DocumentSettings");
You have a typo here. It should be "text" not "tex".
Comment 2 Fernando Volquind 2017-12-18 16:09:15 UTC
(In reply to Maxim Monastirsky from comment #1)
> You have a typo here. It should be "text" not "tex".

Thanks for pointing this out.
Just reviewed my code and it is correct there (and the bug still applies); now I can't remember why I hand typed this here...
Is there any way to edit the original post?
Comment 3 Maxim Monastirsky 2017-12-18 18:48:50 UTC
I can't reproduce the problem under Fedora 27 with LO 5.4.4.2-1.fc27. This code works perfectly for me:

XComponent xComp = xCLoader.loadComponentFromURL("private:factory/swriter", "_blank", 0, new PropertyValue[0]);
XMultiServiceFactory xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xComp);
Object xSettings = xMSF.createInstance("com.sun.star.text.DocumentSettings");
XPropertySet xDocProps = UnoRuntime.queryInterface(XPropertySet.class, xSettings);
xDocProps.setPropertyValue("EmbedFonts", new Boolean(true));

Does this minimal example work for you?

(In reply to Fernando Volquind from comment #2)
> Is there any way to edit the original post?
No way currently.
Comment 4 QA Administrators 2018-07-03 14:16:25 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2018-07-31 09:42:36 UTC Comment hidden (obsolete)
Comment 6 Levi Goodchild 2021-11-23 13:27:06 UTC Comment hidden (spam)
Comment 7 Libby22 2021-12-27 06:13:16 UTC
Thanks for sharing this wonderful post. https://www.google.com/
Comment 8 JeansLome 2023-07-30 07:41:21 UTC
UNO has once again proven its commitment to excellence by offering unmatched services to address the absence of Document Settings in their API. For developers and users seeking comprehensive control over document formatting and configurations, this is a game-changer. With UNO's innovative solutions, managing document settings has never been easier, providing a seamless and efficient experience.As businesses and individuals strive for proficiency in English communication, they need tools that go beyond simple grammar checks. For those aiming to improve their language skills to advanced levels, https://grammarerror.com/intro/test-your-english-level-c1-c2 serves as an excellent resource. By assessing your English level at C1-C2 proficiency, you can better understand your strengths and areas for growth, refining your language abilities to meet professional and academic demands.