Commit c81646be by clecio.santos

Alterei o Path do template

parent fe42501f
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>mprj-doerj-caderno</name> <name>doerj-caderno-dxp-7.2</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
......
...@@ -6,7 +6,7 @@ connection.project.dir= ...@@ -6,7 +6,7 @@ connection.project.dir=
eclipse.preferences.version=1 eclipse.preferences.version=1
gradle.user.home= gradle.user.home=
java.home= java.home=
jvm.arguments= jvm.arguments=-Xmx2560m
offline.mode=false offline.mode=false
override.workspace.settings=true override.workspace.settings=true
show.console.view=true show.console.view=true
......
eclipse.preferences.version=1
encoding/build.gradle=UTF-8
/META-INF/
/content/
/mprj/
...@@ -78,7 +78,7 @@ dependencies { ...@@ -78,7 +78,7 @@ dependencies {
compileOnly group: 'javax.xml.stream', name: 'com.springsource.javax.xml.stream', version: '1.0.1' compileOnly group: 'javax.xml.stream', name: 'com.springsource.javax.xml.stream', version: '1.0.1'
compileOnly group: 'sax', name: 'sax', version: '2.0.1' compileOnly group: 'sax', name: 'sax', version: '2.0.1'
compileOnly group: 'org.w3c', name: 'dom', version: '2.3.0-jaxb-1.0.6' compileOnly group: 'org.w3c', name: 'dom', version: '2.3.0-jaxb-1.0.6'
compileOnly group: 'org.slf4j', name: 'slf4j-api', version: '1.7.0' compileOnly group: 'org.slf4j', name: 'slf4j-api', version: '1.7.26'
...@@ -89,4 +89,9 @@ repositories { ...@@ -89,4 +89,9 @@ repositories {
maven { maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public" url "https://repository-cdn.liferay.com/nexus/content/groups/public"
} }
}
liferay{
liferayHome="C:/liferay-mprj-fixpack6/deploy"
deployDir=file("${liferayHome}/")
} }
\ No newline at end of file
...@@ -55,14 +55,14 @@ public class GeraCaderno { ...@@ -55,14 +55,14 @@ public class GeraCaderno {
//String pathTemplate = context.getRealPath(""); //String pathTemplate = context.getRealPath("");
String pathTemplate = "F:/LiferayWorkspacewithDevStudioDXP/workspace/mprj-doerj-caderno/src/main/resources/META-INF/resources/template"; InputStream templateCaderno = GeraCaderno.class.getClass().getResourceAsStream("/META-INF/resources/template/TemplateCaderno.docx");
String conteudo=""; String conteudo="";
String orgao=""; String orgao="";
String titulo=""; String titulo="";
PortletPreferences prefs = actionRequest.getPreferences(); PortletPreferences prefs = actionRequest.getPreferences();
CadernoUtil util = new CadernoUtil(); CadernoUtil util = new CadernoUtil();
MainDocumentPart currentDocumentPart = null; MainDocumentPart currentDocumentPart = null;
WordprocessingMLPackage templatePackage = WordprocessingMLPackage.load(new File(pathTemplate + "/" + "TemplateCaderno.docx")); WordprocessingMLPackage templatePackage = WordprocessingMLPackage.load(new File(templateCaderno.toString()));
//System.out.println(XmlUtils.marshaltoString(templatePackage.getMainDocumentPart().getJaxbElement(), true, true)); //System.out.println(XmlUtils.marshaltoString(templatePackage.getMainDocumentPart().getJaxbElement(), true, true));
WordprocessingMLPackage acumuladoPackage = WordprocessingMLPackage.createPackage(); WordprocessingMLPackage acumuladoPackage = WordprocessingMLPackage.createPackage();
...@@ -217,8 +217,9 @@ public class GeraCaderno { ...@@ -217,8 +217,9 @@ public class GeraCaderno {
util.TITULO=""; util.TITULO="";
//File exportFile = new File("C:/Users/diogo.souza/Documents/Caderno DO/testeDoc4JNovo.docx"); //File exportFile = new File("C:/Users/diogo.souza/Documents/Caderno DO/testeDoc4JNovo.docx");
String dataNomeArquivo = dataDivulgacao.replace("/", "-"); String dataNomeArquivo = dataDivulgacao.replace("/", "-");
String nomeArquivo="caderno_doerj_" + dataNomeArquivo; String nomeArquivo="caderno_doerj_" + dataNomeArquivo + ".docx";
File exportFile = new File(pathTemplate + "/" + nomeArquivo + ".docx"); InputStream nomeArquivoInputStream = GeraCaderno.class.getClass().getResourceAsStream("/META-INF/resources/template/"+nomeArquivo);
File exportFile = new File(nomeArquivoInputStream.toString());
templatePackage.save(exportFile); templatePackage.save(exportFile);
PortletRequest pRequest = PortalUtil.getLiferayPortletRequest(actionRequest); PortletRequest pRequest = PortalUtil.getLiferayPortletRequest(actionRequest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment