StimVinsh / xdocreport

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

The href can't word when use[#list ][#/list] #37

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,gays

«[#list developers as developer]»
«${developer.name}»
${developer.mail} --->here is the href 
«[/#list]»
When I write this in the word template.The href can't change in the out put file
Give me some idea.
Thanks 

Original issue reported on code.google.com by x.resolute@gmail.com on 2 Sep 2011 at 12:27

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

At first, it seems that your attached docx is not the well. I hava attached the 
docx that I suppose you have tried to create.

I have tested and the link is bad (mailto:${developer.mail} instead of 
mailto:angelo.zerr@gmail.com)

Is that your problem?

Hyperlink works in a table but not when Hyperlink is outside a table. It seems 
that MS Word doesn't manage the same XML

Hyperlink outside a table : 

----------------------------------------------------
<w:r w:rsidR="002F7C89">
    <w:t xml:space="preserve"> </w:t>
</w:r>
<w:r>
    <w:fldChar w:fldCharType="begin" />
</w:r>
<w:r w:rsidR="00062859">
    <w:instrText>HYPERLINK "mailto:$%7bdeveloper.mail%7d"</w:instrText>
</w:r>
<w:r>
    <w:fldChar w:fldCharType="separate" />
</w:r>
<w:r w:rsidR="00062859">
    <w:rPr>
        <w:rStyle w:val="Lienhypertexte" />
    </w:rPr>
    <w:t>${developer.mail}</w:t>
</w:r>
<w:r>
    <w:fldChar w:fldCharType="end" />
</w:r>
----------------------------------------------------

Hyperlink inside a table : 

----------------------------------------------------
<w:p w:rsidR="00855D40" w:rsidRDefault="002B4893" w:rsidP="00E8369E">
    <w:pPr>
        <w:rPr>
            <w:color w:val="FF0000" />
        </w:rPr>
    </w:pPr>
    <w:hyperlink r:id="rId5" w:history="1">
        <w:r w:rsidR="00E8369E" w:rsidRPr="00E8369E">
            <w:rPr>
                <w:rStyle w:val="Lienhypertexte" />
            </w:rPr>
            <w:t>${</w:t>
        </w:r>
        <w:proofErr w:type="spellStart" />
        <w:r w:rsidR="00E8369E" w:rsidRPr="00E8369E">
            <w:rPr>
                <w:rStyle w:val="Lienhypertexte" />
            </w:rPr>
            <w:t>developers.mail</w:t>
        </w:r>
        <w:proofErr w:type="spellEnd" />
        <w:r w:rsidR="00E8369E" w:rsidRPr="00E8369E">
            <w:rPr>
                <w:rStyle w:val="Lienhypertexte" />
            </w:rPr>
            <w:t>}</w:t>
        </w:r>
    </w:hyperlink>
</w:p>
----------------------------------------------------

Regards Angelo

Original comment by angelo.z...@gmail.com on 2 Sep 2011 at 12:59

Attachments:

GoogleCodeExporter commented 8 years ago
The Hyperlink problem must be fixed in the next release 0.9.2

Original comment by angelo.z...@gmail.com on 2 Sep 2011 at 1:00

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi:
Thanks for your reply
That is my problem.
I want to make many tables like this 
table1
    title: url+title
    ptime:${article.ptime} |  keyWord:${article.keyWord}
    content:${article.content}
table2:
       title: url+title
      ptime:${article.ptime} |  keyWord:${article.keyWord}
      content:${article.content}
......and so on
each article is a single table
so I use
[#list articles as article]
table:
       title: url+title
      ptime:${article.ptime} |  keyWord:${article.keyWord}
      content:${article.content}
[#/list]
but the url  can't be change
Have some idea make it work?
Use html convert to docx?
Thanks

Original comment by x.resolute@gmail.com on 2 Sep 2011 at 1:56

GoogleCodeExporter commented 8 years ago
Hi,

You mean that sometimes hyperlink works (url is replaced) and sometimes it 
doesn't works? If it's not the problem, could you attache your docx please? If 
it's your problem, it's the same bug that you have written. It seems that MS 
Word describes Hyperlink with 2 means. I have managed one case, not the both. I 
will try to fix the problem as soon as I will find time.

Regards Angelo

Original comment by angelo.z...@gmail.com on 2 Sep 2011 at 2:11

GoogleCodeExporter commented 8 years ago
Problem is fixed in the Git repository. The 0.9.2 release will fix this problem 
(planned on the next week) 
http://code.google.com/p/xdocreport/wiki/XDocReport092

Original comment by angelo.z...@gmail.com on 9 Sep 2011 at 11:34

GoogleCodeExporter commented 8 years ago
HI,
I use your sample to test the word template .
I add a field in the role object  and use foreach
«#foreach($d in $developers)»
Identity
Name : «$d.Name»
Last Name : «$d.LastName»
Email : $d.Mail
Roles
Roles
«@before-row#foreach($r in $d.Roles)»«$r.Name» $r.url--->here is the 
problem(it doesn't word)
«@after-row#end»

«#end»
Whe use twice it  doesn't word 

Original comment by x.resolute@gmail.com on 26 Sep 2011 at 3:49

Attachments:

GoogleCodeExporter commented 8 years ago
Hi, 

Yes it's a bug -( Docx hyperlink are very awful to manage! I will try to fix 
that.
Regards Angelo

Original comment by angelo.z...@gmail.com on 26 Sep 2011 at 4:18

GoogleCodeExporter commented 8 years ago
HI
maybe use like this
 <Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image2.png"/>
        <#list allArticles?keys as key>
        <#list allArticles[key] as article>
        <Relationship Id="rId${article.md5Key}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Target="${article.href}" TargetMode="External"/>
        </#list>
        </#list>

<w:hyperlink r:id="rId${article.md5Key}" w:history="1">
                    <w:r w:rsidRPr="00A25F6A">
                      <w:rPr>
                        <w:rStyle w:val="ae"/>
                        <w:rFonts w:ascii="宋体" w:hAnsi="宋体" w:cs="宋体" w:hint="eastAsia"/>
                        <w:sz w:val="18"/>
                        <w:szCs w:val="18"/>
                      </w:rPr>
                      <w:t>${article.title}</w:t>
                    </w:r>
                  </w:hyperlink>

Original comment by x.resolute@gmail.com on 27 Sep 2011 at 4:05

GoogleCodeExporter commented 8 years ago
Hi,

Your suggestion is right and I have tried to do that, but there is a bug. The 
big problem is that <w:hyperlink and <Relationship declaration are not in the 
same XML entry. So in the <Relationship you must add the well #foreach but it's 
too complex (your bug is a sample)!

So I have restarted from scratch the docx hyperlink management (my work is 
commited) and your sample seems working! The basic idea is that the 
document.xml which declare <w:hyperlink generate w:hyperlink/@id and populate a 
list of Hyperlink with the model value (ex:mailto: angelo.zerr@gmail.com) and 
this list is putted in the IContext. 

The second XML entry word/_rels/document.xml.rels which declare <Relationship 
loop for this hyperlink list putted in the context. 

More this solution is more performant, because it avoid to loop for Java list 
model twice (one time for document.xml and one time for 
word/_rels/document.xml.rels ).

JUnit is working, my sample is working and your sample is working. Is it 
possible to test that now because we wish create the XDocReport 0.9.2 release 
soon.

Thank a lot.

Regards Angelo

Original comment by angelo.z...@gmail.com on 27 Sep 2011 at 7:55

GoogleCodeExporter commented 8 years ago
HI,
Your idea is right .Look forward to your next release.

Original comment by x.resolute@gmail.com on 27 Sep 2011 at 2:05

GoogleCodeExporter commented 8 years ago
Hi,

Ok go go for the relase (teh release is planned this week)!
If you willhave trouble again, I will fix teh problem in another release 
otherwise I will close this ticket after you will test with your case.

Regards Angelo

Original comment by angelo.z...@gmail.com on 27 Sep 2011 at 2:08

GoogleCodeExporter commented 8 years ago
Hi,
Thank a lot.

Original comment by x.resolute@gmail.com on 27 Sep 2011 at 2:25

GoogleCodeExporter commented 8 years ago

Original comment by angelo.z...@gmail.com on 1 Nov 2011 at 6:50