Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify font size in Open Office with VFP 9

Status
Not open for further replies.

dalinx

Programmer
Nov 1, 2017
3
0
0
RO
Hi!
How can I modify the font size in the table of Open Office with VFP 9 (with automation).
Thank you very much!
 
You'd be better off in a forum addressing Open Office, the OLE automation server that is used for automation is the same for VFP or any other programming language able to use OLE automation, and the automation server methods, properties and the overall object model of Open Office therefore are completely independent of VFP and so the automation is the same.

In short, any language has the concept of variables that are objects, in this case the root of all automation is an automation server object. You already have code at hand, that has a starting point like this:
Code:
Local loOpenOfficeWriter
loOpenOfficeWriter = CreateObject(...)

And then you use methods of that object, that are part of the Open Office automation server and its definition and completely unrelated to VFP. So that's a case for asking in an Open Office programming forum., might not even exist here on tek-tips.

In dubio pro reo: Of course it's more likely you find someone that has automated Open Office Writer with VFP here, but it's not the main objective of VFP to automate other applications. So you might wait, you might already have asked in other forums as well.

I only mention it as it's already the second question you ask specific to Open Office though you had no fruitful response to your first question, judging by you not responding to the already given answers.

Chriss
 
Just to add to what Chris has told you: it is clear from your earlier question that you are working with ODT files. ODT is a document type that can be processed by several different applications, notably OpenOffice Writer, but also Libre Office and Microsoft Word (and possibly Google Docs and others). So the answer to this question depends on which of those applications you (or, more importantly, your users) have installed.

Certainly Microsoft Word would allow you to open an ODT file, change its font, and save it (as an ODT or DOCX). And you could automate that from within VFP. But presumably your users are working with ODT because they are using an application other than Microsoft Word.

Perhaps you could clarify the situation, and in particular why you are working with ODTs. And if it turns out that you need to automate OpenOffice or LibreOffice, I would second what Chris said about asking in a specific forum for the application.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Here's a quick bit of code that will change the font size, using Word automation. It should work OK with ODT files, but you will need Microsoft Word to be installed:

Code:
loWord = CREATEOBJECT("word.application")
loDoc = loWord.Documents.Add("test.odt")
loRange = loDoc.Range(0, loDoc.Characters.Count)
loRange.Font.Size = 12  && or whatever you want to set it to
loDoc.Save
loDoc.Close
loWord.Quit

This is just off the top of my head, so no guarantees. Also, there is no error checking, for example to check that the document exists. It's just meant to give you a start.

If you have Libre Office or OpenOffice instead of Word, the general technique should be similar, but the actual code will be different.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top