Uploading and displaying a word file
is there a way to use the attachment-data to upload a file and then have it displayed using the viewfile or viewdoc confluence macro?
2
people have this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The company marked this question as answered.
-
Inappropriate?Hi Dean,
The simplest thing would be something like this (you will also need the Visibility Plugin):
{show-if:display=edit}{attachment-data:File}{show-if}{hide-if:display=edit}{report-on:injected=true}{viewfile:^%data:File > attachment:filename%}{report-on}{hide-if}
I'm not 100% sure of the syntax required by {viewfile} - you may or may not need the leading '^', and you might need a parameter name. -
Inappropriate?the issue now appears to be with the viewfile or viewdoc macro not accepting the variable as the file name.
i get the following error message
viewfile: The viewfile macro is unable to locate the attachment "^" on this page
-
Inappropriate?Ah, whoops. It should be this for the report-on macro:
{viewfile:^%data:File > reference:value > attachment:filename%}{report-on}
Forgot the reference:value... -
Inappropriate?here is the complete code and it still can't find the file..the Image one works
|| Image File: | {attachment-data:Image1|include=.*gif,.*jpg} |
|| Image Display: | {report-image:data:Image1 > reference:value > attachment:download path} |
|| Word File: | {attachment-data:Word1} |
|| Word Display: | {viewfile:data:Word1 > reference:value > attachment:download path}| -
Inappropriate?Most macros don't support 'supplier' chains directly, so you have to inject them with {report-on}. Try this for your second case:
|| Word File: | {attachment-data:Word1} |
|| Word Display: | {report-on:injected=true}{viewfile:%data:Word1 > reference:value > attachment:download path%}{report-on}| -
Inappropriate?almost there..changed your code to this
|| Word File: | {attachment-data:Word1|include=.*doc} |
|| Word Display: | {report-on:injected=true}{viewdoc:name=%data:Word1 > reference:value > attachment:download path%}{report-on}|
then got this error.
viewdoc: The viewfile macro is unable to locate the attachment "/download/attachments/11013027/ACom3CompensationPlansCatalog.doc?version=1&modificationDate=1251600304403" on this page
that is the correct link if you add the full space path. -
Inappropriate?this works
|| Word File: |{hidden-data} {attachment-data:Word1|include=.*doc}{hidden-data} |
|| Word Display: | {report-on:injected=true}{viewdoc:name=%data:Word1 > reference:value > attachment:file name%}{report-on}| -
Inappropriate?Actually, I don't think you want 'attachment:download path' in this case. I'm pretty sure the macro will just want the file name, not the full path. Try 'attachment:filename' instead.
-
Inappropriate?|| Attach the file: | {attachment-data:resource} ||
|| Document Display: | {report-on:injected=true}{viewdoc:name=%data:resource > reference:value > attachment:file name%}{report-on}|
I can confirm this is operational.
I did have to use SCAFFOLDING-STABLE-486, but this appears to be a scaffolding related problem, rather than anything else.
Thanks David, for your responses.
I’m thankful
Loading Profile...



EMPLOYEE
