|
|
@@ -44,6 +44,7 @@ public class Word2Pdf {
|
|
|
Document doc = new Document(inputStream);// 原始excel路径
|
|
|
|
|
|
FontSettings font = new FontSettings();
|
|
|
+ // String path = "./"; // 开发环境直接取项目目录下的SIMKAI.TTF 就能跑起来
|
|
|
String path = "/usr/share/fonts";
|
|
|
FolderFontSource folderFontSource = new FolderFontSource(path, true);
|
|
|
// ArrayList fontSources = (ArrayList) Arrays.asList(font.getFontsSources());
|
|
|
@@ -52,11 +53,7 @@ public class Word2Pdf {
|
|
|
fontSources.add(folderFontSource);
|
|
|
FontSourceBase[] updatedFontSources = (FontSourceBase[]) fontSources.toArray(new FontSourceBase [fontSources.size()]);
|
|
|
font.setFontsFolder(path, true);
|
|
|
- font.setDefaultFontName("");
|
|
|
- font.setDefaultFontName("SimHei");
|
|
|
- font.setDefaultFontName("NSimSun");
|
|
|
- font.setDefaultFontName("STFangsong");
|
|
|
- font.setDefaultFontName("STZhongsong");
|
|
|
+ font.setDefaultFontName("SimKai");
|
|
|
font.setFontsSources(updatedFontSources);
|
|
|
doc.setFontSettings(font);
|
|
|
|