use of net.heartsome.cat.converter.msexcel2007.document.WorkBookPart in project translationstudio8 by heartsome.
the class XliffReader method read2SpreadsheetDoc.
public void read2SpreadsheetDoc(String spreadsheetDocFile, String xliffFile, String sklFile, IProgressMonitor monitor) throws InternalFileException {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask(Messages.getString("msexcel.xliff2mse.task1"), 5);
loadFile(xliffFile);
monitor.worked(1);
monitor.setTaskName(Messages.getString("msexcel.xliff2mse.task2"));
try {
SpreadsheetDocument.open(sklFile);
monitor.worked(1);
WorkBookPart wb = SpreadsheetDocument.workBookPart;
List<SheetPart> sheetList = wb.getSheetParts();
readSheet(sheetList, new SubProgressMonitor(monitor, 1));
monitor.setTaskName(Messages.getString("msexcel.xliff2mse.task3"));
wb.save();
monitor.worked(1);
try {
ZipUtil.zipFolder(spreadsheetDocFile, SpreadsheetDocument.spreadsheetPackage.getPackageSuperRoot());
} catch (IOException e) {
logger.error("", e);
}
monitor.worked(1);
} finally {
SpreadsheetDocument.close();
monitor.done();
}
}
use of net.heartsome.cat.converter.msexcel2007.document.WorkBookPart in project translationstudio8 by heartsome.
the class SpreadsheetReader method read2XliffFile.
/**
* 将内容读入到XLIFF文件
* @param xlfOs
* XLIFF文件BufferWriter
* @param filterRedCell
* 是否需要过滤标记为红色的单元格
* @param monitor
* @throws InternalFileException
* @throws IOException
* ;
*/
public void read2XliffFile(String inputFile, BufferedWriter xlfOs, String sklFilePath, boolean filterRedCell, IProgressMonitor monitor) throws InternalFileException, IOException {
this.xlfOs = xlfOs;
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask("", 5);
try {
monitor.setTaskName(Messages.getString("msexcel.mse2xliff.task2"));
// open source file
SpreadsheetDocument.open(inputFile);
monitor.worked(1);
monitor.setTaskName(Messages.getString("msexcel.mse2xliff.task3"));
// load current workbook
WorkBookPart wb = SpreadsheetDocument.workBookPart;
if (filterRedCell) {
this.filterStyleIndex = wb.getStylesPart().getFilterCellStyle();
}
// read worksheet
List<SheetPart> sheetList = wb.getSheetParts();
readSheets(sheetList, new SubProgressMonitor(monitor, 2));
// save current document
wb.save();
monitor.worked(1);
monitor.setTaskName(Messages.getString("msexcel.mse2xliff.task4"));
// generate skl file
saveSklFile(sklFilePath);
monitor.worked(1);
} finally {
SpreadsheetDocument.close();
}
monitor.done();
}
Aggregations