use of net.heartsome.cat.document.xlsx.XlsxRowReader in project translationstudio8 by heartsome.
the class Xlsx2TbxConverter method doConvert.
@Override
public void doConvert(String targetFile, IProgressMonitor monitor) throws Exception {
try {
out = new FileOutputStream(new File(targetFile));
XlsxRowReader reader = new XlsxRowReader(this.xlsxFile, 20, handler);
try {
reader.readRows(monitor);
} catch (ParserConfigurationException e) {
LOGGER.error("", e);
throw new Exception(Messages.getString("converter.xlsx2tmx.parseExcle.error"));
} catch (SAXException e) {
LOGGER.error("", e);
if ("LANG-CODE-ERORR".equals(e.getMessage())) {
throw new Exception(Messages.getString("converter.common.vaild.langcode.error"));
} else if ("DIFF--SRC-LANG-CODE".equals(e.getMessage())) {
throw new Exception(Messages.getString("converter.common.appendtmx.diffsrcLang.error"));
} else if ("EMPTY-LANG-CODE".equals(e.getMessage())) {
throw new Exception(Messages.getString("converter.common.vaild.langcode.error"));
} else if ("DUPLICATE-LANG-CODE-ERORR".equals(e.getMessage())) {
throw new Exception(Messages.getString("converter.common.vaild.duplicatelangcode.error"));
}
} catch (IOException e) {
LOGGER.error("", e);
throw new Exception(Messages.getString("converter.xlsx2tmx.parseExcle.error"));
} catch (OpenXML4JException e) {
LOGGER.error("", e);
throw new Exception(Messages.getString("converter.xlsx2tmx.parseExcle.error"));
}
String s = generateTbxEnd();
if (s != null && s.length() != 0) {
writeString(s);
}
} catch (FileNotFoundException e) {
LOGGER.error("", e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
}
}
}
}
Aggregations