atronwestphal / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

Replace $ parameter issue #356

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

  I am using Docx Reporting WEB Application for replacing some $ parameters with content. Some times it will replace the all the place holders with content but, some times only few $ symbols replacement was done. 
My aim is to replace all the $ symbols with content.

so please let me know how to archive this problem..

i also attach Required files  
SelectDocName.jsp is contains select box for selecting Document
Test1 is the input, Test2 is my output file...     

Original issue reported on code.google.com by vinay.mr...@gmail.com on 22 Jan 2014 at 2:24

Attachments:

GoogleCodeExporter commented 8 years ago
Hi, 

Please takes time to read our XDocReport wiki. Your problem is that you don't 
use mergefield to set your variable. I suggest you to read 
https://code.google.com/p/xdocreport/wiki/DocxReportingQuickStart

The explanation with your problem is that MS Word split sometimes your text 
that you type in several XML element.

For instance if you unzip Test1.docx you have a word/document.xml : 

 * $drname is not splitted and I suppose this variable is well replaced. Here the XML content : 

----------------------
<w:r>
  <w:t>$drname</w:t> 
</w:r>
----------------------

 * $tdate is splitted in several XML elements. I suppose that you have a problem with the replace. Here the XML content : 

----------------------
<w:r w:rsidR="001C6694">
  <w:tab /> 
  <w:t>$t</w:t> 
</w:r>
<w:r w:rsidR="001C6694" w:rsidRPr="001C6694">
  <w:t>date</w:t> 
</w:r>
----------------------

If you use mergefield, you will have not this problem.

Regards Angelo

Original comment by angelo.z...@gmail.com on 22 Jan 2014 at 2:34

GoogleCodeExporter commented 8 years ago
Issue 357 has been merged into this issue.

Original comment by angelo.z...@gmail.com on 22 Jan 2014 at 2:35

GoogleCodeExporter commented 8 years ago
Thank you for giving reply,
By using mergefield i design my docx, but some times it was not display.

can you please tell me how to unzip word documet.
Test1 is input
Test1 op is output file 

Original comment by vinay.mr...@gmail.com on 23 Jan 2014 at 5:59

Attachments:

GoogleCodeExporter commented 8 years ago
Please See the attached screenshots i didn't find ChampsFusion in my word 
document 
I am using MS Office 2007.. 

Original comment by vinay.mr...@gmail.com on 23 Jan 2014 at 6:59

GoogleCodeExporter commented 8 years ago
> By using mergefield i design my docx, but some times it was not display.
Your docx don't use mergefield, you are using comments.

> can you please tell me how to unzip word documet.
You unzip your docx with WinZip for instance and you will see several XML 
entries (word/document.xml for instance)

> Please See the attached screenshots i didn't find ChampsFusion
Have you read 
https://code.google.com/p/xdocreport/wiki/DocxReportingQuickStart? If you use 
the XDocReport macro, it will be easy to use mergefield.

You will find a lot of tutorial in Internet for using MS Word Mergefield.

Original comment by angelo.z...@gmail.com on 23 Jan 2014 at 8:15

GoogleCodeExporter commented 8 years ago
No Thanks,but thanks for giving MergeField idea. I got the output 
ChampField=MergeField in my word documet.

one Issue i found in MyReprtServlet which was attached in the previous issue
At  first time i Download the word document(Test1.docx), it is fine, but after 
downloading i add some content in input document(Test1.docx) it is show only 
old downloaded document

getSourceStream() Method second time is not called
please provide solution...

Thank you,

Original comment by vinay.mr...@gmail.com on 23 Jan 2014 at 8:18

GoogleCodeExporter commented 8 years ago
> At  first time i Download the word document(Test1.docx), it is fine, but 
after 
>downloading i add some content in input document(Test1.docx) it is show only 
old >downloaded document

>getSourceStream() Method second time is not called

It's because XDocReport cache the report to improve performance to avoid 
loading the report on each time you generate a report.

In 1.0.4, you will have the capability to control the cacheReport (see 
https://code.google.com/p/xdocreport/issues/detail?id=358).

If you wish to clear the cache with 1.0.3 (for dev mode), you can hack 
XDocReport by removing the report from the cache after it was loaded by adding 
to your servlet :

--------------------------------
    @Override
    protected IXDocReport loadReport( String reportId, XDocReportRegistry registry, HttpServletRequest request )
        throws IOException, XDocReportException
    {
        IXDocReport report = super.loadReport( reportId, registry, request );
        super.getRegistry( request ).unregisterReport( report );
        return report;
    }
--------------------------------

But in production mode, your report must be cached.

Original comment by angelo.z...@gmail.com on 23 Jan 2014 at 9:07

GoogleCodeExporter commented 8 years ago
Thank you....

Original comment by vinay.mr...@gmail.com on 23 Jan 2014 at 1:09

GoogleCodeExporter commented 8 years ago
Hi,
In previous ans you said use mergefield in your document design 
https://code.google.com/p/xdocreport/wiki/DocxReportingQuickStart 
I think  XDocReport macro is the one of the way for use mergefield.
But i follow this process 
https://code.google.com/p/xdocreport/wiki/DocxDesignReport#Create_with_MS_Word
May be  this is the another way to use mergefield.  
which is most preferable?  , Still i get $ signs in my documet...

Original comment by vinay.mr...@gmail.com on 24 Jan 2014 at 11:40

GoogleCodeExporter commented 8 years ago
The 2 solutions are the same : 

 *  https://code.google.com/p/xdocreport/wiki/DocxDesignReport#Create_with_MS_Word => standard mean to create MS Word mergefield. With this mean you must type the name of the mergefield.
 * https://code.google.com/p/xdocreport/wiki/DocxReportingQuickStart => the macro shows you the fields that you can insert. it's more helpful than insert at hand the name of the mergefield.

> Still i get $ signs in my documet...
If you have this problem : 
 * you don't use mergefield. Have you tried the macro? If it doesn't work, please post on MS Word forum how to create mergefield.
 * the name of your mergefield is not the same than your Java context.

I have not a big time, so I cannot help you more.

Original comment by angelo.z...@gmail.com on 24 Jan 2014 at 1:34

GoogleCodeExporter commented 8 years ago
Thanks for replying...
I didn't get $ signs 
 protected IXDocReport loadReport( String reportId, XDocReportRegistry registry, HttpServletRequest request )
        throws IOException, XDocReportException
    {
        IXDocReport report = super.loadReport( reportId, registry, request );
        super.getRegistry( request ).unregisterReport( report );
        return report;
    }

with this methods placed in my program.
Thanks....

Original comment by vinay.mr...@gmail.com on 24 Jan 2014 at 2:42

GoogleCodeExporter commented 8 years ago
Hi,
 How to change the generated docx file name, I am using Docx Reporting in WEB Application with Servlet, in this input file name and output file name will be same, but i want to change the generated output file neme... how to change? 

Thanks...

Original comment by vinay.mr...@gmail.com on 28 Jan 2014 at 11:47

GoogleCodeExporter commented 8 years ago
Override getContentDisposition( String reportId, MimeMapping mimeMapping, 
HttpServletRequest request ) in your servlet 
https://code.google.com/p/xdocreport/source/browse/document/fr.opensagres.xdocre
port.document/src/main/java/fr/opensagres/xdocreport/document/web/BaseXDocReport
Servlet.java#344

An implement like this : 

-------------------------------------------
@Override
protected String getContentDisposition( String reportId, MimeMapping 
mimeMapping, HttpServletRequest request )
{
     //if ( mimeMapping != null )
     //{
         String fileName = "MyOutput.docx"; //mimeMapping.formatFileName( reportId );
         return getContentDisposition( fileName );
     //}
     //return null;
}
-------------------------------------------

Original comment by angelo.z...@gmail.com on 28 Jan 2014 at 1:38

GoogleCodeExporter commented 8 years ago
Thank you so much...

Original comment by vinay.mr...@gmail.com on 28 Jan 2014 at 1:50

GoogleCodeExporter commented 8 years ago
After a long time i have a doubt by using Docx Reporting in WEB Application 
with Servlet.
I attached format that i used to export word document.
By using that format of code any memory issues are raised ? or any variable is 
cache the data ? 
We need to close any InputStream or other .. ? 
In my application i export more than 100 documents per a day 

Original comment by vinay.mr...@gmail.com on 21 Aug 2014 at 5:15

Attachments:

GoogleCodeExporter commented 8 years ago
I don't understand what you mean? What is your problem?

Original comment by angelo.z...@gmail.com on 21 Aug 2014 at 7:54