提交 f125f614 authored 作者: 孙洁清's avatar 孙洁清

解决内存溢出

上级 b21ea02e
......@@ -33,7 +33,7 @@ import java.util.regex.Matcher;
* FreeMakerUtils.writeFile("E:/doc/text.doc",document);
*/
public class DocumentWordUtil {
public static String Maintitle(){
public String Maintitle(){
return "<w:p>\n" +
" <w:pPr>\n" +
" <w:pStyle w:val=\"2\"/>\n" +
......@@ -53,7 +53,7 @@ public class DocumentWordUtil {
" </w:p>";
}
public static String subheading(DocumentTitleEnum documentTitleEnum){
public String subheading(DocumentTitleEnum documentTitleEnum){
return "<w:p>\n" +
" <w:pPr>\n" +
......@@ -97,7 +97,7 @@ public class DocumentWordUtil {
}
public static String getTableString(List<TechnologyContent> tables, String technologyName, String stra){
public String getTableString(List<TechnologyContent> tables, String technologyName, String stra){
//key 表格标题,value 内容
String s3 = tableTile(technologyName, stra);
String s4 = Matcher.quoteReplacement(s3);
......@@ -112,14 +112,14 @@ public class DocumentWordUtil {
return sb.toString();
}
public static String gettb(TechnologyContent technologyContent){
public String gettb(TechnologyContent technologyContent){
StringBuilder sb=new StringBuilder();
String biaoge = biaoge(technologyContent);
sb.append(biaoge);
return sb.toString();
}
public static String tabtb(){
public String tabtb(){
return "<w:tc>\n" +
" <w:tcPr>\n" +
" <w:tcW w:w=\"#colW#\" w:type=\"dxa\"/>\n" +
......@@ -146,7 +146,7 @@ public class DocumentWordUtil {
" </w:p>\n" +
" </w:tc>";
}
public static String tabtr(){
public String tabtr(){
return "<w:tc>\n" +
" <w:tcPr>\n" +
" <w:tcW w:w=\"#colW#\" w:type=\"dxa\"/>\n" +
......@@ -175,7 +175,7 @@ public class DocumentWordUtil {
}
public static String tr(){
public String tr(){
return "<w:tr>\n" +
" <w:tblPrEx>\n" +
" <w:tblBorders>\n" +
......@@ -204,7 +204,7 @@ public class DocumentWordUtil {
" <w:trHeight w:val=\"400\" w:h-rule=\"atLeast\"/>\n" +
" </w:trPr>";
}
public static String standtab(){
public String standtab(){
return "<w:tbl>\n" +
" <w:tblPr>\n" +
" <w:tblStyle w:val=\"a9\"/>\n" +
......@@ -257,7 +257,7 @@ public class DocumentWordUtil {
" </w:tbl>";
}
public static void yem(){
public void yem(){
String str="<w:sectPr>\n" +
" <w:hdr w:type=\"odd\">\n" +
" <w:p>\n" +
......@@ -464,7 +464,7 @@ public class DocumentWordUtil {
" <w:docGrid w:type=\"lines\" w:line-pitch=\"312\"/>\n" +
" </w:sectPr>";
}
public static String tableTile(String technologyName,String strategy){
public String tableTile(String technologyName,String strategy){
return "<w:p><w:pPr><w:tabs><w:tab w:val=\"left\" w:pos=\"5422\"/></w:tabs></w:pPr><w:r><w:rPr><w:rFonts w:hint=\"fareast\"/></w:rPr><w:t>关键技术:"+technologyName+"</w:t></w:r><w:r><w:rPr><w:rFonts w:hint=\"fareast\"/></w:rPr><w:tab/></w:r><w:r><w:rPr><w:rFonts w:hint=\"fareast\"/></w:rPr><w:t>替换策略:"+strategy+"</w:t></w:r></w:p>"+"<w:tbl>\n" +
" <w:tblPr>\n" +
" <w:tblStyle w:val=\"a13\"/>\n" +
......@@ -582,7 +582,7 @@ public class DocumentWordUtil {
" </w:tc>\n" +
" </w:tr>\n";
}
public static String enddard(){
public String enddard(){
return "<w:sectPr>\n" +
" <w:hdr w:type=\"odd\">\n" +
" <w:p>\n" +
......@@ -792,7 +792,7 @@ public class DocumentWordUtil {
" </w:body>\n" +
"</w:wordDocument>";
}
public static String standard(){
public String standard(){
String str="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
"<?mso-application progid=\"Word.Document\"?>\n" +
"<w:wordDocument xmlns:w=\"http://schemas.microsoft.com/office/word/2003/wordml\" xmlns:v=\"urn:schemas-microsoft-com:vml\"\n" +
......@@ -1374,7 +1374,7 @@ public class DocumentWordUtil {
" <wx:sect>\n";
return str;
}
public static String biaoge(TechnologyContent content){
public String biaoge(TechnologyContent content){
return "<w:tr>\n" +
" <w:tblPrEx>\n" +
" <w:tblBorders>\n" +
......@@ -1470,16 +1470,16 @@ public class DocumentWordUtil {
" </w:tr>";
}
public static String createDocument(DocumentPage documentPage) {
public String createDocument(DocumentPage documentPage) {
StringBuilder sb=new StringBuilder();
//前面部分内容
String standard = DocumentWordUtil.standard();
String enddard = DocumentWordUtil.enddard();
String standard = standard();
String enddard = enddard();
//标题内容
String maintitle = DocumentWordUtil.Maintitle();
String maintitle = Maintitle();
// String subheading = DocumentWordUtil.subheading();
//标题下的内容
String standContent = DocumentWordUtil.content();
String standContent = content();
//表格内容
......@@ -1493,7 +1493,7 @@ public class DocumentWordUtil {
for (TitleHead titleHead : titleHeads) {
DocumentTitleEnum byCode = DocumentTitleEnum.getByCode(titleHead.getParentId());
if (byCode != null) {
String titleContent = DocumentWordUtil.subheading(byCode);
String titleContent = subheading(byCode);
//标题名称
String name = titleHead.getName();
......
......@@ -201,18 +201,19 @@ public class WpsUtil {
StringBuilder youhua = new StringBuilder();
StringBuilder xiugai = new StringBuilder();
StringBuilder weizhi = new StringBuilder();
DocumentWordUtil documentWordUtil=new DocumentWordUtil();
for (String string : strings) {
if (string.contains("优化")) {
List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "优化");
String str = documentWordUtil.getTableString(technologyContents, string, "优化");
youhua.append(str);
} else if (string.contains("不支持")) {
List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "重新开发");
String str = documentWordUtil.getTableString(technologyContents, string, "重新开发");
xiugai.append(str);
} else if (string.contains("未知")) {
List<TechnologyContent> technologyContents = teMap.get(string);
String str = DocumentWordUtil.getTableString(technologyContents, string, "验证修改或重新开发");
String str = documentWordUtil.getTableString(technologyContents, string, "验证修改或重新开发");
weizhi.append(str);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论