Docker Ubuntu环境下无法执行LibreOffice宏的问题求助
Docker Ubuntu环境下无法执行LibreOffice宏的问题求助
我现在碰到一个棘手的问题:我用Docker基于Ubuntu 22.04构建了一个镜像,目的是用它来执行LibreOffice宏处理XLSX文件。这套流程在Windows上能正常跑起来,但到了Docker环境里就完全卡住,shell停在那儿没任何反应。
先贴一下我的Dockerfile内容:
from ubuntu:22.04 run apt-get update \ && apt-get -y install --no-install-recommends \ default-jre \ libreoffice-calc libreoffice-java-common \ git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* run libreoffice --headless --terminate_after_init
之后我执行了以下操作来给XLSX文件应用宏:
首先复制宏文件到指定目录:
cp ./Module1.xba ~/.config/libreoffice/4/user/basic/Standard/
然后执行LibreOffice命令:
soffice --nolockcheck --nologo --headless --norestore --language=ja --nofirststartwizard ./docs/test.xlsx "macro:///Standard.Module1.Main?language=Basic&location=application"
我的宏文件Module1.xba内容如下:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> <!-- * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">REM ***** BASIC ***** Sub Main ThisComponent.calculateAll() ThisComponent.store() ThisComponent.close(True) StarDesktop.terminate() End Sub </script:module>
请问各位,我是不是需要安装额外的依赖包,或者调整什么配置才能让宏在Docker环境里正常运行呢?
备注:内容来源于stack exchange,提问作者Issei Morita
相关产品推荐
相关产品推荐

