Skip to main content
Tweeted twitter.com/#!/StackSharePoint/status/87599800102559744
Bounty Ended with no winning answer by CommunityBot
Clean up; edited title; added 235 characters in body
Source Link
Alex Angas
  • 6k
  • 9
  • 50
  • 89

How can I set the relative path to a workbook ofin the ChartWebPart relativelyChart Web Part, and use the WPit within a template?

First, sorry for this relatively simple and stupid question, but the ChartWebPart is probably the worst documented WebPart I've been working with so far. (Official and community side!)

I'll try to explain my situation. We have a team-website site in our solution. (SPS 2010 - Enterprise). On this site there's a list. For every new item in the list, it creates a new websitesite from a template. structure

Structure:

  • team-website
  • website 1
  • website 2
  • ...

onOn the template for these websitessites there is (among other elements) a document-list library with a single excel-fileExcel file (.xlsx) and a ChartWebPartChart Web Part. The datasourcedata source of the ChartWebPartChart Web Part is the excel-file.Excel file (using Excel Services) And there is the problem, you see:.

The source for the WebPartweb part can be set absolutely without much hassle and it works as it should. But, since the template is used for these various websites, this isn't a working solution and I haven't figured out a way to set the urlURL relatively on the WPweb part. (Or did I? > see below)

A logical solution for me was it to add a new web-part part to my visual stutio ProjektVisual Studio project, that derives from the ChartWebPartChartWebPart. I checked the msdnMSDN and found the WorkBookUrl-member which sounded promising to me. I overridWorkBookUrl member and overrode the OnInit() method:

protected override void OnInit(EventArgs e)
{
    string excelFile = SPContext.Current.Web.ServerRelativeUrl 
        + "/Dokumente/siteSheet.xlsx";
    this.WorkBookUrl = excelFile;
}

Then I did a test, and it worked like a charm. After that, I made some last changes on the chart's design and saved the websitesite as a template. From this templetetemplate I created a websitesite and... no ChartWebPartChart Web Part. (It is defintelydefinitely there, since the debugger jumps in on the break-pointbreakpoint I set in the OnInit-method method, but I can't see it!) 

I don't know what's the problem here. Either my code doesn't workswork in the end or it's something else. I tried some other things too, like editing the DataBindingString, nothing worked.

Please, can someone help me out? I'm seriously dying on this one

EDIT:EDIT: I tried using a list instead, and it worked fine. That still doesn't answersanswer my question, of why it doesn't work with the WorkBookUrl though.

How can I set the workbook of the ChartWebPart relatively, and use the WP within a template?

First, sorry for this relatively simple and stupid question, but the ChartWebPart is probably the worst documented WebPart I've been working with so far. (Official and community side!)

I'll try to explain my situation. We have a team-website in our solution. (SPS 2010 - Enterprise) On this site there's a list. For every new item in the list, it creates a new website from a template. structure:

  • team-website
  • website 1
  • website 2
  • ...

on the template for these websites there is (among other elements) a document-list with a single excel-file (.xlsx) and a ChartWebPart. The datasource of the ChartWebPart is the excel-file. (using Excel Services) And there is the problem, you see:

The source for the WebPart can be set absolutely without much hassle and it works as it should. But, since the template is used for these various websites, this isn't a working solution and I haven't figured out a way to set the url relatively on the WP. (Or did I? > see below)

A logical solution for me was it to add a new web-part to my visual stutio Projekt, that derives from the ChartWebPart. I checked the msdn and found the WorkBookUrl-member which sounded promising to me. I overrid the OnInit() method:

protected override void OnInit(EventArgs e)
{
    string excelFile = SPContext.Current.Web.ServerRelativeUrl 
        + "/Dokumente/siteSheet.xlsx";
    this.WorkBookUrl = excelFile;
}

Then I did a test, and it worked like a charm. After that, I made some last changes on the chart's design and saved the website as a template. From this templete I created a website and... no ChartWebPart. (It is defintely there, since the debugger jumps in on the break-point I set in the OnInit-method, but I can't see it!) I don't know what's the problem here. Either my code doesn't works in the end or it's something else. I tried some other things too, like editing the DataBindingString, nothing worked.

Please, can someone help me out? I'm seriously dying on this one

EDIT: I tried using a list instead, and it worked fine. That still doesn't answers my question, why it doesn't work with the WorkBookUrl though.

How can I set the relative path to a workbook in the Chart Web Part, and use it within a template?

We have a team site in our solution (SPS 2010 - Enterprise). On this site there's a list. For every new item in the list, it creates a new site from a template.

Structure:

  • team-website
  • website 1
  • website 2
  • ...

On the template for these sites there is (among other elements) a document library with a single Excel file (.xlsx) and a Chart Web Part. The data source of the Chart Web Part is the Excel file (using Excel Services).

The source for the web part can be set without much hassle and it works as it should. But, since the template is used for these various websites, this isn't a working solution and I haven't figured out a way to set the URL relatively on the web part.

A logical solution for me was to add a new web part to my Visual Studio project, that derives from ChartWebPart. I checked MSDN and found the WorkBookUrl member and overrode the OnInit() method:

protected override void OnInit(EventArgs e)
{
    string excelFile = SPContext.Current.Web.ServerRelativeUrl 
        + "/Dokumente/siteSheet.xlsx";
    this.WorkBookUrl = excelFile;
}

Then I did a test, and it worked like a charm. After that, I made some last changes on the chart's design and saved the site as a template. From this template I created a site and... no Chart Web Part. (It is definitely there, since the debugger jumps in on the breakpoint I set in the OnInit method, but I can't see it!) 

I don't know what's the problem here. Either my code doesn't work in the end or it's something else. I tried some other things too, like editing the DataBindingString, nothing worked.

EDIT: I tried using a list instead, and it worked fine. That still doesn't answer my question of why it doesn't work with the WorkBookUrl though.

Bounty Started worth 50 reputation by Markus Schwalbe
Added some info and correction
Source Link

First, sorry for this relatively simple and stupid question, but the ChartWebPart is probably the worst documented WebPart I've been working with so far. (Official and community side!)

I'll try to explain my situation. We have a team-website in our solution. (SPS 2010 - Enterprise) On this site there's a list. For every new item in the list, it creates a new website from a template. structure:

  • team-website
  • website 1
  • website 2
  • ...

on the template for these websites there is (among other elements) a document-list with a single excel-file (.xlsx) and a ChartWebPart. The datasource of the ChartWebPart is the excel-file. (using Excel Services) And there is the problem, you see:

The source for the WebPart can be set absolutely without much hassle and it works as it should. But, since the template is used for these various websites, this isn't a working solution and I haven't figured out a way to set the url relatively on the WP. (Or did I? > see below)

A logical solution for me was it to add a new web-part to my visual stutio Projekt, that derives from the ChartWebPart. I checked the msdn and found the WorkBookUrl-member which sounded promising to me. I overrid the OnInit() method:

protected override void OnInit(EventArgs e)
{
    string excelFile = SPContext.Current.Web.ServerRelativeUrl 
        + "/Dokumente/siteSheet.xlsx";
    this.WorkBookUrl = excelFile;
}

Then I did a test, and it worked like a charm. After that, I made some last changes on the chart's design and saved the website as a template. From this templete I created a website and... no ChartWebPart. (It is defintely there, since the debugger jumps in on the break-point I set in the OnInit-method., but I can't see it!) I don't know what's the problem here. Either my methodcode doesn't works in the end or it's something else. I tried some other things too, like editing the DataBindingString, nothing worked.

Please, can someone help me out? I'm seriously dying on this one

EDIT: I tried using a list instead, and it worked fine. That still doesn't answers my question, why it doesn't work with the WorkBookUrl though.

First, sorry for this relatively simple and stupid question, but the ChartWebPart is probably the worst documented WebPart I've been working with so far. (Official and community side!)

I'll try to explain my situation. We have a team-website in our solution. (SPS 2010 - Enterprise) On this site there's a list. For every new item in the list, it creates a new website from a template. structure:

  • team-website
  • website 1
  • website 2
  • ...

on the template for these websites there is (among other elements) a document-list with a single excel-file (.xlsx) and a ChartWebPart. The datasource of the ChartWebPart is the excel-file. (using Excel Services) And there is the problem, you see:

The source for the WebPart can be set absolutely without much hassle and it works as it should. But, since the template is used for these various websites, this isn't a working solution and I haven't figured out a way to set the url relatively on the WP. (Or did I? > see below)

A logical solution for me was it to add a new web-part to my visual stutio Projekt, that derives from the ChartWebPart. I checked the msdn and found the WorkBookUrl-member which sounded promising to me. I overrid the OnInit() method:

protected override void OnInit(EventArgs e)
{
    string excelFile = SPContext.Current.Web.ServerRelativeUrl 
        + "/Dokumente/siteSheet.xlsx";
    this.WorkBookUrl = excelFile;
}

Then I did a test, and it worked like a charm. After that, I made some last changes on the chart's design and saved the website as a template. From this templete I created a website and... no ChartWebPart. (It is defintely there, since the debugger jumps in on the break-point I set in the OnInit-method.) I don't know what's the problem here. Either my method doesn't works in the end or it's something else. I tried some other things too, like editing the DataBindingString, nothing worked.

Please, can someone help me out? I'm seriously dying on this one

First, sorry for this relatively simple and stupid question, but the ChartWebPart is probably the worst documented WebPart I've been working with so far. (Official and community side!)

I'll try to explain my situation. We have a team-website in our solution. (SPS 2010 - Enterprise) On this site there's a list. For every new item in the list, it creates a new website from a template. structure:

  • team-website
  • website 1
  • website 2
  • ...

on the template for these websites there is (among other elements) a document-list with a single excel-file (.xlsx) and a ChartWebPart. The datasource of the ChartWebPart is the excel-file. (using Excel Services) And there is the problem, you see:

The source for the WebPart can be set absolutely without much hassle and it works as it should. But, since the template is used for these various websites, this isn't a working solution and I haven't figured out a way to set the url relatively on the WP. (Or did I? > see below)

A logical solution for me was it to add a new web-part to my visual stutio Projekt, that derives from the ChartWebPart. I checked the msdn and found the WorkBookUrl-member which sounded promising to me. I overrid the OnInit() method:

protected override void OnInit(EventArgs e)
{
    string excelFile = SPContext.Current.Web.ServerRelativeUrl 
        + "/Dokumente/siteSheet.xlsx";
    this.WorkBookUrl = excelFile;
}

Then I did a test, and it worked like a charm. After that, I made some last changes on the chart's design and saved the website as a template. From this templete I created a website and... no ChartWebPart. (It is defintely there, since the debugger jumps in on the break-point I set in the OnInit-method, but I can't see it!) I don't know what's the problem here. Either my code doesn't works in the end or it's something else. I tried some other things too, like editing the DataBindingString, nothing worked.

Please, can someone help me out? I'm seriously dying on this one

EDIT: I tried using a list instead, and it worked fine. That still doesn't answers my question, why it doesn't work with the WorkBookUrl though.

Source Link

How can I set the workbook of the ChartWebPart relatively, and use the WP within a template?

First, sorry for this relatively simple and stupid question, but the ChartWebPart is probably the worst documented WebPart I've been working with so far. (Official and community side!)

I'll try to explain my situation. We have a team-website in our solution. (SPS 2010 - Enterprise) On this site there's a list. For every new item in the list, it creates a new website from a template. structure:

  • team-website
  • website 1
  • website 2
  • ...

on the template for these websites there is (among other elements) a document-list with a single excel-file (.xlsx) and a ChartWebPart. The datasource of the ChartWebPart is the excel-file. (using Excel Services) And there is the problem, you see:

The source for the WebPart can be set absolutely without much hassle and it works as it should. But, since the template is used for these various websites, this isn't a working solution and I haven't figured out a way to set the url relatively on the WP. (Or did I? > see below)

A logical solution for me was it to add a new web-part to my visual stutio Projekt, that derives from the ChartWebPart. I checked the msdn and found the WorkBookUrl-member which sounded promising to me. I overrid the OnInit() method:

protected override void OnInit(EventArgs e)
{
    string excelFile = SPContext.Current.Web.ServerRelativeUrl 
        + "/Dokumente/siteSheet.xlsx";
    this.WorkBookUrl = excelFile;
}

Then I did a test, and it worked like a charm. After that, I made some last changes on the chart's design and saved the website as a template. From this templete I created a website and... no ChartWebPart. (It is defintely there, since the debugger jumps in on the break-point I set in the OnInit-method.) I don't know what's the problem here. Either my method doesn't works in the end or it's something else. I tried some other things too, like editing the DataBindingString, nothing worked.

Please, can someone help me out? I'm seriously dying on this one