プロジェクトを Jxls 1.x から Jxls 2.2.8 に移行しています。現在のテンプレートでは、Spring MessageSource を使用して、messageSource.getMessage("message.key", locale) を使用してレポートのタイトルをローカライズしています。1.x バージョンでは機能しますが、2.x バージョンではメッセージを解決しません。
メソッドにパラメーターがある場合、メッセージの解決は失敗しますが、messageSource オブジェクトで toString() メソッドを呼び出すと、機能し、セルに文字列が出力されます。
クラスのコードは次のとおりです。
public void convertToXLS(final Map<String, Object> p_model, final InputStream p_template, final OutputStream p_file, final Locale p_locale) throws InvalidFormatException, IOException {
DeviceEventsDownloadWebModel deviceEventsDownloadWebModel = (DeviceEventsDownloadWebModel) p_model.get("deviceEventsDownloadWebModel");
Context context = new Context();
context.putVar("messageSource", getMessageSource());
context.putVar("locale", p_locale);
context.putVar("deviceEvents", deviceEventsDownloadWebModel.getDeviceEvents());
JxlsHelper.getInstance().processTemplate(p_template, p_file, context);
}
問題を解決するための提案はありますか?messageSource を関数として設定することも試みますが、機能しません。