Установка видимости листов, строк или столбцов не работает, используя XpropertySet :: setPropertyValue () . Он не бросает исключение или что-то в этом роде, он просто не меняет значение свойства.
Я не уверен, что это задумано, я не смог ничего найти в их документации. Jodconverter. < /p>
Мой текущий код: < /p>
private void processCalc(@NonNull XComponent document) throws Exception {
foreachSheet(document, sheet -> {
setProperty(sheet, "IsVisible", true);
final var cursor = sheet.createCursor();
final var usedAreaCursor = Lo.qi(XUsedAreaCursor.class, cursor);
usedAreaCursor.gotoStartOfUsedArea(false);
usedAreaCursor.gotoEndOfUsedArea(true);
final var columnRowRange = Lo.qi(XColumnRowRange.class, usedAreaCursor);
setVisible(columnRowRange.getRows());
setVisible(columnRowRange.getColumns());
});
}
private static void setVisible(XInterface x) throws IndexOutOfBoundsException, WrappedTargetException, PropertyVetoException, UnknownPropertyException {
final var indexAccess = Lo.qi(XIndexAccess.class, x);
for (int i = 0; i < indexAccess.getCount(); i++) {
final var byIndex = indexAccess.getByIndex(i);
final var range = Lo.qi(XCellRange.class, byIndex);
setProperty(range, "IsVisible", true);
}
}
public static void setProperty(XInterface object, String name, boolean value) throws PropertyVetoException, WrappedTargetException, UnknownPropertyException {
final var propertySet = Lo.qi(XPropertySet.class, object);
propertySet.setPropertyValue(name, value);
}
public static void foreachSheet(XComponent document, FailableConsumer consumer) throws Exception {
final var spreadsheetDocument = Lo.qiOptional(XSpreadsheetDocument.class, document);
if (spreadsheetDocument.isEmpty()) {
throw new IllegalArgumentException("Provided document was not of type CALC!");
}
foreachSheet(spreadsheetDocument.get(), consumer);
}
public static void foreachSheet(XSpreadsheetDocument spreadsheetDocument, FailableConsumer consumer) throws Exception {
final var sheets = spreadsheetDocument.getSheets();
final var indexedSheets = Lo.qi(XIndexAccess.class, sheets);
final var count = indexedSheets.getCount();
for (var i = 0; i < count; i++) {
final var sheet = Lo.qi(XSpreadsheet.class, indexedSheets.getByIndex(i));
consumer.accept(sheet);
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... -or-column
LibreOffice Uno Java API: не может установить видимость листа, строки или столбца ⇐ JAVA
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
LibreOffice Uno Java API: не может установить видимость листа, строки или столбца
Anonymous » » в форуме JAVA - 0 Ответы
- 4 Просмотры
-
Последнее сообщение Anonymous
-
-
-
LibreOffice Uno API: разрывы страницы столбца не сброшены, в отличие от разрывов строк
Anonymous » » в форуме Python - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-
-
-
LibreOffice Uno API: разрывы страницы столбца не сброшены, в отличие от разрывов строк
Anonymous » » в форуме Python - 0 Ответы
- 14 Просмотры
-
Последнее сообщение Anonymous
-