COM OLE Automation bridge; property Name not supported

2014-08-28 Thread Peter Eberlein

Hi,

because aoo cannot open all Word docs without crashing 
(https://issues.apache.org/ooo/show_bug.cgi?id=125419), I wanted to let 
do WinWord the job.


I need to know the names of all bookmarks.
So StarBasic looks like this:

wordInstance = CreateObject(Word.Application)
wordDoc = wordInstance.documents.open(c:\test.docx)
For i = 1 To wordDoc.Bookmarks.Count
bookmark = doc.Bookmarks(i)
msgbox bookmark.Name 'fails
'if the property has arguments:
msgbox bookmark.hasProperty(Name) 'false [1]
msgbox bookmark.getValue(Name) 'property not supported
next




Any idea how to get the bookmarks name?
I think Name is a key word and can not be used in StarBasic.

Regards

Peter

[1] 
https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Using_Automation_Objects_from_UNO


-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: COM OLE Automation bridge; property Name not supported

2014-08-28 Thread Peter Eberlein

Hi Mathias,
it's only a typo, meant wordDoc.Bookmarks(i)

the error property or method not found occurs in line
 msgbox bookmark.Name

Regards

Peter

meant
Am 28.08.2014 18:03, schrieb Mathias Röllig:

Hi Peter!


If you using the right syntax (I don't know):


For i = 1 To wordDoc.Bookmarks.Count

^^^

 bookmark = doc.Bookmarks(i)

   ^^^

 msgbox bookmark.Name 'fails

'yes, it must
'Option Explicit enabled?

Regards, Mathias

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org




-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Database grid control; modifying columns on the fly

2013-11-22 Thread Peter Eberlein

Hi,

the grid control belongs to a form, which is controlled dynamically by 
different sql-commands.
Depending on the select-command only those columns should be visible, 
which are selected.
I tried the following: In edit mode the grid contains all columns of the 
table.
After modifying the command I use the hidden-property of the columns. 
But this is very slow and not reversible.


Any other ideas how to solve this?

Regards

Peter

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: API for setting a resultset to masterfields (com.sun.star.text.fieldmaster.Database)

2013-11-07 Thread Peter Eberlein

Hi Ariel,

Am 06.11.2013 00:30, schrieb Ariel Constenla-Haile:

Hi Peter,

On Tue, Nov 05, 2013 at 03:12:45PM +0100, Peter Eberlein wrote:

Hi,

in the gui there's a command Data into fields for a selected row in
Database sources.  Any ideas how to get the selected row (bookmark of
the resultset) into these fields with api?  I remember that Fernand
asked Frank S. a similar question, but didn't found it anymore.


AFAIK there is no API for that, but you can dispatch the UNO command
with the proper arguments sequence; see the attached example, it uses
record numbers instead of bookmarks, but it should work with bookmarks
too (set BookmarkSelection to True).


thank you for your helpful example (attachment dropped).

Regards

Peter

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



com.sun.star.text.SectionFileLink

2013-10-11 Thread Peter Eberlein

Hi,

if I break the link of a TextSection (which is linked to another section 
in another document) by setting the FileLink property (FileURL is 
empty), then the content of the section vanishes.


If I do the same with GUI, then the content isn't lost.

Any ideas how to preserve the content?

Regards

Peter

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Change column property in XTextTable

2013-09-19 Thread Peter Eberlein

Hi,
Am 19.09.2013 13:36, schrieb K.Misha:

Hello!



I have this code:



Reference  XTextDocument  xTextDocument (xWriterComponent,UNO_QUERY);

Reference XModel  aDrawDoc (xTextDocument, UNO_QUERY);

ReferenceXMultiServiceFactory aFact(aDrawDoc,UNO_QUERY);

Reference XTextTable  xTextTable(
aFact-createInstance(OUString::createFromAscii(com.sun.star.text.TextTable
)), UNO_QUERY);



xTextTable-initialize(4,4);



ReferenceXText xText = xTextDocument-getText();

ReferenceXTextRange xTextRange = xText-getStart();

ReferenceXTextContent xTextContent(xTextTable, UNO_QUERY);



xText-insertTextContent( xTextRange, xTextContent, 0 );



ReferenceXTableColumns xTableColumns = xTextTable-getColumns();

Any rCol = xTableColumns-getByIndex(0);



Reference XPropertySet  xPropSet2(rCol, UNO_QUERY);

Any mPropVal1 = makeAny((unsigned short)150);



But here i have an error:

xPropSet2-setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(Width)),
mPropVal1);



Can you help me with changing column properties in text table?



you have to use the com.sun.star.text.TableColumnSeparator.

In Java this can look like this:

XTextTablesSupplier xTablesSupplier = (XTextTablesSupplier) 
UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
XTextTable xTextTable = (XTextTable) 
UnoRuntime.queryInterface(XTextTable.class, 
xTablesSupplier.getTextTables().getByName(Table1));
XPropertySet xPropertySet = (XPropertySet) 
UnoRuntime.queryInterface(XPropertySet.class, xTextTable);
com.sun.star.text.TableColumnSeparator[] sep = (TableColumnSeparator[]) 
xPropertySet.getPropertyValue(TableColumnSeparators);

sep[0].Position = 1000;
xPropertySet.setPropertyValue(TableColumnSeparators, sep);

Regards

Peter

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



XText Interface of XTextSection

2013-09-18 Thread Peter Eberlein

Hi,

the service css.text.TextFrame exports the XTextFrame Interface with the 
getText() method.
The service css.text.TextSection exports the XTextSection Interface, but 
I'm missing a convenient method to get the XText of the section. The 
XTextContent's anchor of the section gives me the XTextRange of the 
parent of the section.


Any ideas? (I don't want to iterate over the paragraphs to obtain the 
section)?


Regards

Peter

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org