拆分表格角标修正
This commit is contained in:
+33
-5
@@ -17,8 +17,6 @@ import com.adc.da.slrs.standardSplit.service.SarFileSplitInfoEOService;
|
|||||||
import com.adc.da.sys.common.SelectionResult;
|
import com.adc.da.sys.common.SelectionResult;
|
||||||
import com.adc.da.sys.util.LoginUserUtil;
|
import com.adc.da.sys.util.LoginUserUtil;
|
||||||
import com.adc.da.sys.util.UUIDUtils;
|
import com.adc.da.sys.util.UUIDUtils;
|
||||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
@@ -37,7 +35,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.adc.da.common.SplitFilePragraTypeEnum;
|
import com.adc.da.common.SplitFilePragraTypeEnum;
|
||||||
|
|
||||||
@@ -167,7 +164,9 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
|||||||
try {
|
try {
|
||||||
AttFileEO attFileEO = attFileEOService.getFileInfo(sarFileSplitInfoEO.getAttId());
|
AttFileEO attFileEO = attFileEOService.getFileInfo(sarFileSplitInfoEO.getAttId());
|
||||||
//String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
//String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||||
String readFilePath = filePath + attFileEO.getFilePath() + attFileEO.getFileName();
|
//String readFilePath = filePath + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||||
|
//String readFilePath = filePath + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||||
|
String readFilePath = "C:/Users/syxy/Desktop/GB 1589-2016 汽车、挂车及汽车列车外廓尺寸、轴荷及质量限值.docx";
|
||||||
|
|
||||||
InputStream is = new FileInputStream(readFilePath); //需要将文件路更改为word文档所在路径。
|
InputStream is = new FileInputStream(readFilePath); //需要将文件路更改为word文档所在路径。
|
||||||
XWPFDocument doc = new XWPFDocument(is);
|
XWPFDocument doc = new XWPFDocument(is);
|
||||||
@@ -184,8 +183,9 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
|||||||
String regex = "^[0-9]*$";
|
String regex = "^[0-9]*$";
|
||||||
for (IBodyElement element : elements) {
|
for (IBodyElement element : elements) {
|
||||||
// 段落
|
// 段落
|
||||||
|
XWPFParagraph p = null;
|
||||||
if (element instanceof XWPFParagraph) {
|
if (element instanceof XWPFParagraph) {
|
||||||
XWPFParagraph p = (XWPFParagraph)element;
|
p = (XWPFParagraph)element;
|
||||||
|
|
||||||
// 处理段落生成编号不识别问题
|
// 处理段落生成编号不识别问题
|
||||||
String paragraphString = p.getText();
|
String paragraphString = p.getText();
|
||||||
@@ -660,8 +660,36 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addItermsConditionsOfTable(SarFileSplitItemsEO message, List<SarFileSplitItemsValEO> itemsValList, XWPFTable table) throws IOException {
|
private void addItermsConditionsOfTable(SarFileSplitItemsEO message, List<SarFileSplitItemsValEO> itemsValList, XWPFTable table) throws IOException {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
StringBuilder tabaleStringNew = new StringBuilder("");
|
StringBuilder tabaleStringNew = new StringBuilder("");
|
||||||
//将表格转为html字符串
|
//将表格转为html字符串
|
||||||
|
int numberOfRows = table.getNumberOfRows();
|
||||||
|
for (int i = 0; i <numberOfRows ; i++) {
|
||||||
|
List<XWPFTableCell> tableCells = table.getRow(i).getTableCells();
|
||||||
|
for (int j = 0; j <tableCells.size() ; j++) {
|
||||||
|
List<XWPFParagraph> paragraphs = tableCells.get(j).getParagraphs();
|
||||||
|
for (XWPFParagraph data : paragraphs){
|
||||||
|
for (XWPFRun xwrun : data.getRuns()) {
|
||||||
|
VerticalAlign subscript = xwrun.getSubscript();
|
||||||
|
String smalltext = xwrun.getText(0);
|
||||||
|
if (ObjectUtils.isNotEmpty(smalltext)) {
|
||||||
|
switch (subscript) {
|
||||||
|
case BASELINE:
|
||||||
|
xwrun.setText(smalltext);
|
||||||
|
break;
|
||||||
|
case SUBSCRIPT:
|
||||||
|
xwrun.setText("<span class=sub>" + smalltext + "</span>");
|
||||||
|
break;
|
||||||
|
case SUPERSCRIPT:
|
||||||
|
xwrun.setText("<span class=sup>" + smalltext + "</span>");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ReadWordTable readWordTable = new ReadWordTable();
|
ReadWordTable readWordTable = new ReadWordTable();
|
||||||
String tableStr = readWordTable.readTable(table);
|
String tableStr = readWordTable.readTable(table);
|
||||||
tabaleStringNew.append(tableStr);
|
tabaleStringNew.append(tableStr);
|
||||||
|
|||||||
Reference in New Issue
Block a user