+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Exporting page content

Exporting page content

4 posts, 0 answered
  1. Chris Johannsen
    Chris Johannsen avatar
    6 posts
    Registered:
    13 Aug 2009
    13 Aug 2009
    Link to this post
    I am needing to export ONLY the Page content from a site in order to send to a third-party translation company. Is there way to do this using the Export Tool without getting the Generic Content, Lists, etc.?
  2. John
    John avatar
    32 posts
    Registered:
    08 Oct 2008
    13 Aug 2009
    Link to this post
    Hi Chris,

    I beieve you're asking how to get content without using the Sitefinity API and not how to get content except lists and modules, am I correct? When you generate a template, all of the content goes into XML files for each module. I unpacked a zip file in Community template from the Project Manager and I found the XML files:

    C:\Program Files\telerik\Sitefinity3.7\ProjectManager\Templates\Community\App_Data\Sitefinity_DataImport\Community

    Here is the content from the lists.xml file:

      <ListItems> 
        <ID>44683e6c-e458-436f-98de-43e106eb5e48</ID> 
        <ParentID>309adcf2-c343-48c6-a466-7d3c636b7ad5</ParentID> 
        <Content>&lt;a href="http://www.microsoft.com/en/us/default.aspx"&gt;www.microsoft.com&lt;/a&gt;&lt;br /&gt; 
    </Content> 
        <Headline>Microsoft</Headline> 
        <Ordinal>0</Ordinal> 
      </ListItems> 
      <ListItems> 
        <ID>cd728612-9784-44ca-a2e4-c0d8acf6a47a</ID> 
        <ParentID>309adcf2-c343-48c6-a466-7d3c636b7ad5</ParentID> 
        <Content>&lt;a href="http://msdn2.microsoft.com/en-us/default.aspx"&gt;www.msdn2.microsoft.com&lt;/a&gt;&lt;br /&gt; 
    </Content> 
        <Headline>MSDN</Headline> 
        <Ordinal>1</Ordinal> 
      </ListItems> 
      <ListItems> 
        <ID>2d24260f-ee19-41ba-88f4-084608f4d213</ID> 
        <ParentID>309adcf2-c343-48c6-a466-7d3c636b7ad5</ParentID> 
        <Content>&lt;a href="http://www.telerik.com"&gt;www.telerik.com&lt;/a&gt;&lt;br /&gt; 
    </Content> 
        <Headline>Telerik</Headline> 
        <Ordinal>2</Ordinal> 
      </ListItems> 
    </Sitefinity> 

    If you want, you can parse this content using LINQ to XML and write it to a text file. To create a template, please follow the instructions on page 159 of the User Manual.

    -John
  3. Chris Johannsen
    Chris Johannsen avatar
    6 posts
    Registered:
    13 Aug 2009
    13 Aug 2009
    Link to this post
    I don't mind using the API if that is the best way to achieve the goal. I am asking how to get the content, specifically any textual content, from the Pages. I don't need List or Generic data. I like the idea of writing out to a text file, a csv would be ideal.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Aug 2009
    Link to this post
    Hello Chris Johannsen,

    You can find the control which date you want to export, let's say GenericContent control's content. Then you can write this content to txt or another type of file.

    Sample code:

       ContentPlaceHolder holder = Page.Master.FindControl("Menu"as ContentPlaceHolder; 
            if (holder != null
            { 
                GenericContent gcControl = holder.FindControl("GenericContent1"as GenericContent; 
                if (gcControl != null
                { 
                    StreamWriter sw = new StreamWriter("TestFile1.txt"); 
                    // add more logic here 
                } 
     
            }  


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered