Export a section of page instead of whole page

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Export a section of page instead of whole page

Vishal
Consider a page with 4 headings. I can export a whole page as pdf. But how can I export only a section of 1 heading as pdf instead of whole page with 4 headings..
Example:

Heading 1
(para 1)

Heading 2
(para 2)

Heading 3
(para 3)

Heading 4
(para 4)

Suppose I have to export only Heading 3 with (para 3). What are the ways to do this?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export a section of page instead of whole page

vmassol
Administrator
Hi,

> On 30 Mar 2017, at 06:49, Vishal <[hidden email]> wrote:
>
> Consider a page with 4 headings. I can export a whole page as pdf. But how
> can I export only a section of 1 heading as pdf instead of whole page with 4
> headings..
> Example:
>
> Heading 1
> (para 1)
>
> Heading 2
> (para 2)
>
> Heading 3
> (para 3)
>
> Heading 4
> (para 4)
>
> Suppose I have to export only Heading 3 with (para 3). What are the ways to
> do this?

You can’t do this easily. What you could do is have several pages and {{include}} them in your top level page so that you can export the page you wish.

An alternative would be to do some coding with scripting but I haven’t done it and can’t help. The idea would be to create a temporary page with scripting where you’d use the XWiki XDOM API to extract content you wish to extract and save it in that temporary page before starting the export on that page.

Thanks
-Vincent

> --
> View this message in context: http://xwiki.475771.n2.nabble.com/Export-a-section-of-page-instead-of-whole-page-tp7603284.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export a section of page instead of whole page

Thomas Mortagne
Administrator
You have a "section" parameter in display macro (see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Display%20Macro).
The limitation (or the good things depending on what you want exactly)
is that it includes the heading itself too.

So to use that, what you could do is create another page in which you
put {{display reference="Space.MyBigPage" section="HMyheading"/}} and
export that page.

On Thu, Mar 30, 2017 at 9:09 AM, Vincent Massol <[hidden email]> wrote:

> Hi,
>
>> On 30 Mar 2017, at 06:49, Vishal <[hidden email]> wrote:
>>
>> Consider a page with 4 headings. I can export a whole page as pdf. But how
>> can I export only a section of 1 heading as pdf instead of whole page with 4
>> headings..
>> Example:
>>
>> Heading 1
>> (para 1)
>>
>> Heading 2
>> (para 2)
>>
>> Heading 3
>> (para 3)
>>
>> Heading 4
>> (para 4)
>>
>> Suppose I have to export only Heading 3 with (para 3). What are the ways to
>> do this?
>
> You can’t do this easily. What you could do is have several pages and {{include}} them in your top level page so that you can export the page you wish.
>
> An alternative would be to do some coding with scripting but I haven’t done it and can’t help. The idea would be to create a temporary page with scripting where you’d use the XWiki XDOM API to extract content you wish to extract and save it in that temporary page before starting the export on that page.
>
> Thanks
> -Vincent
>
>> --
>> View this message in context: http://xwiki.475771.n2.nabble.com/Export-a-section-of-page-instead-of-whole-page-tp7603284.html
>> Sent from the XWiki- Users mailing list archive at Nabble.com.
>



--
Thomas Mortagne
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export a section of page instead of whole page

Vishal
Thank you. But creating other page to just export a part of page seems inefficient.
I have two ideas but don't know how can I do that..
1) In export page option dialog, giving choice to select or deselect the headings themselves. Just like what currently cover, comments, etc have.
2) Writing a macro to export the section. It won't be universally used for any section. But at least we could add the macro to some specific section to display a download/export menu.

Any help is much appreciated..
Loading...