Ask Your Question
0

Getting from DependentTextField to Table/Cell, or Vice Versa?

asked 2017-05-01 22:24:22 +0200

I have a series of DependentTextFields dependent on a particular com.sun.star.text.fieldmaster.SetExpression TextFieldMaster of SubType com.sun.star.text.SetVariableType.SEQUENCE. Each DependentTextField is in the column B cell of a row in one of a number of TextTables. Given a particular number in the sequence, I want to find the table and cell containing the DependentTextField having that number (if any).

Going one direction, I can iterate through the tables and their rows to get the Cell object for each column B cell, the text in the cell, and a text cursor for that text. But I can't figure out how to get at the DependentTextField in the cell.

Going another direction, I can get the pertinent TextFieldMaster, get the corresponding DependentTextFields, and iterate through them. But I can't figure out how to find the table and cell that a DependentTextField is in.

Does anyone know how to bridge the gap between Table/Cell and a DependentTextField contained therein?

Suggestions in any language - Java, BASIC, C++, Python, whatever - are welcome!

For the curious... All of this effort's purpose is to find the matching row, and then add some text to the column A cell for the matching row.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-05-02 03:11:52 +0200

Thanks to anyone who considered answering this, but... I finally got a clue, generated a document with the sequence DependentTextFields in the tables as described in the question, and examined a column B cell with MRI. There, after a good amount of digging, I found a TextField at the TextRange at the start of the cell's text, accessible via a TextField property. That TextField was my DependentTextField.

Here's a Java code snippet showing what worked...

XCell xCellB = xTextTable.getCellByName("B" + row);
XText xCellText = UnoRuntime.queryInterface(XText.class, xCellB);
XTextCursor xCellCursor = xCellText.createTextCursor();
XPropertySet xCellStartRangeProps = UnoRuntime.queryInterface(XPropertySet.class, xCellCursor.getStart());
Object oDependentTextField = xCellStartRangeProps.getPropertyValue("TextField");
XDependentTextField xDepTextField = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oDependentTextField);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-05-01 22:24:22 +0200

Seen: 36 times

Last updated: May 02 '17