Setter for ExternalWorkbookPath of ExternalWorkbook in charts?


#21

@dr_oli,

I have observed the issue shared by you and like to share that the issue has been fixed in upcoming Aspose.Slides for .NET 19.6. We will share the good news with you as soon as the product will be shared online.


#22

Thanks Mudassir.
Do you have any estimate when 19.6 will be released?


#23

@dr_oli,

The upcoming version is likely to be available during this week or in next week at maximum.


#24

Hi Mudassir,

I saw that you already released 19.6 where replacement works if your workaround Replace(“file:///”,""); is used.

Now there is one problem - you are not allowing to make changes if link source file does not exist on new location. Error is: “Chart uses external workbook. External workbook is not available or can’t be loaded.” which is not a problem if documents are on local or network drives as there check if file exist or not is accurate.

Problem is with SharePoint - I had link source file before moving documents to SharePoint on following location “C:\Users\user\Documents” and after moving document to SharePoint on “https://company.sharepoint.com/DocLibrary1”. With your check if file on new location exists even when document is available in SharePoint location I am getting crash during changes with upper error.

Can you please do not enforce that file on target location has to exist as changes when documents are on some Web sharing platform will not work?

Thx,
Oliver


#25

@dr_oli,

I have observed the observations shared by you and request you to please provide the suggestions in the form of a working example use case that we may investigate internally on our end for its possibility of implementation.


#26

Sure, just run attached project:

PPTX.LinkSources.Crash.zip (137.3 KB)

In first part I am replacing old Link Source with file that exists and that works and in second part I am making replacement to new Link Source which does not exists.

Main problem here is that Aspose can check if files are on local or network drive so basically if change is rejected I can understand but when documents are on SharePoint even when I make replacement to new Link Source where file exits on SharePoint Aspose.Slides is rejecting changes saying “External workbook is not available or can’t be loaded.” which is not correct as new Link Source is there.

I need option to disable load of new Link Source during changes with Aspose.Slides or that you simply do not make check if new Link Source exists.


#27

@dr_oli,

I have associated information in our issue tracking system. We will share further feedback with you as soon as it will be shared.


#28

Thanks a lot.

As I hope that this is not going to be big change would be extremely appreciated if fix can be provided as a Hotfix (maybe 19.6.1) as that is stopping us to release our software next version :slight_smile:

Plus I am always making good projects to recreate the problem :wink:


#29

@dr_oli,

I have observed your comments. I request for your patience and we will share good news with you soon. I also like to inform that hotfix are only provided to paid support customers as per company policy.


#30

Hi Aspose team,

any news here? I see that status is resolved but according to my previous communication it is not working when files are on any Web platform.

To recap - when change of link source is done you are checking if file on new location exists. In case that new location is file share, local drive,… check will work and will be accurate meaning if file is there Aspose.Slides will make change. If file on new location does not exist you will report "Chart uses external workbook. External workbook is not available or can’t be loaded.”

Problem is that more and more customer are moving to Web platforms like SharePoint, Box,… and there your check will never work as you will try to check if some http(s) location is there and document is in it and Aspose.Slides will return that file does not exist and will not allow change.

What I need is that you do not enforce check if file exists on new location as I’ll do that from coding because I have options to check Web location.

Without removing this enforced check this functionality has 0 value for any Web shared storage and like said more and more customers are going into that direction.

Your feedback will be appreciated.

Thx


#31

@dr_oli,

I like to inform that this issue will be tentatively resolved in Aspose.Slides 19.7 and we will share good news with you soon.


#32

Hi Adnan,

I just installed Aspose.Slides 19.7 and still this functionality does not work.
Like above written - Aspose.Slides, before making change, will check with new link exists. This works when you have new link somewhere on network drive, local drive or similar location. For that Aspose.Slides can check but when documents are on SharePoint even when new link exists Aspose.Slides cannot check them and will crash with error message:

“External workbook is not available or can’t be loaded.”

Can this check be disabled? Like said with SharePoint this functionality is simply useless in a way how Aspose.Slides is working.

It will be also appreciated not to wait months to get change done.

P.S. Bug status should be changes from Resolved to Open.

Thanks in advance,
Oliver


#33

I think that I found what you did - you included in SetExternalWorkbook also option to set if chart should be updated during change. If I set that to false during my change external chart will not be updated but link to new location will be changed.

Is there any option to refresh chart when I open changed document?
Now, after making external chart change with option set to false change is saved in PPTX but when I open changed document it is still pointing to old chart.

Thx,
Oliver


#34

The issues you have found earlier (filed as SLIDESNET-40010) have been fixed in this update.


#35

@dr_oli,

We have included method SetExternalWorkbook(string workbookPath, bool updateChartData).

Parameter updateChartData defines whether excel workbook will be loaded or not. If value is false only workbook path will be updated. Chart data won’t be loaded and updated from the target workbook. It’s useful when target workbook doesn’t exist yet or is not available. If value is true chart data will be updated from the target workbook as regular method SetExternalWorkbook does.

using (Presentation pres = new Presentation())
{
   IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.Pie, 50, 50, 400, 600, true);
   IChartData chartData = chart.ChartData;

   (chartData as ChartData).SetExternalWorkbook("http://path/doesnt/exists", false);
}

As well we wan’t to give you an idea of using IResourceLoadingCallback. In some scenarios you have to implement retrieving of workbook data on your own. For example if access to the source protected by password. In such cases you can use IResourceLoadingCallback.

public void SetExternalWorkbookMethodNetwork()
{
   string externalWbPath = @"http://606178d2.ngrok.io/webgrind/styles/2.xlsx";
   LoadOptions opts = new LoadOptions();
   opts.ResourceLoadingCallback = new WorkbookLoadingHandler();

   using (Presentation pres = new Presentation(opts))
   {
      IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.Pie, 50, 50, 400, 600, false);
      IChartData chartData = chart.ChartData;

      (chartData as ChartData).SetExternalWorkbook(externalWbPath);
   }
}



private class WorkbookLoadingHandler : IResourceLoadingCallback
{
   public ResourceLoadingAction ResourceLoading(IResourceLoadingArgs args)
   {
      string workbookPath = args.OriginalUri;

      if (workbookPath.IndexOf(':') > 1 && !workbookPath.StartsWith("file:///")) // schemed path
      {
         try
         {
            WebRequest request = WebRequest.Create(workbookPath);
            request.Credentials = new System.Net.NetworkCredential("testuser", "testuser");
            using (WebResponse response = request.GetResponse())
            using (Stream responseStream = response.GetResponseStream())
            {
                byte[] buffer = BlobDownloadManager.Download(responseStream);
                responseStream.Read(buffer, 0, buffer.Length);
                args.SetData(buffer);
                return ResourceLoadingAction.UserProvided;
            }
          }
          catch (Exception ex)
          {
             throw new InvalidOperationException(ex.ToString());
          }
      }
      else
      {
          return ResourceLoadingAction.Default;
      }
   }
}

#36

AsposePowerPoint.zip (1.0 MB)
When I use SetExternalWorkbook on binary PowerPoint files, the link is removed from the file.

I’m using Aspose.Slides 19.9.

Attached is an example VS 2017 project with test files.


#37

@JohnGrahamLT,

Can you please share the details of issue incurring on your end so that we may develop understanding of your sample project and help you further. Please also share what is expected result you are hoping to have.


#38

I have cleared up the console output to this project. There is also comments in the code.
When you run it, it will be clear what is happening. See attached: AsposePowerPoint.zip (1.2 MB)

This code processes 4 PowerPoint test files, one-by-one.
1.) opens the file
2.) modifies the chart link path.
3.) saves the PowerPoint file.
THEN,
1.) opens the new PowerPoint file.
2.) prints out the chart link path (to see if it has changed) — for 3 of the files, the chart link path is removed. <— this is bad.


#39

@JohnGrahamLT,

I have worked with information shared and an issue with ID SLIDESNET-41420 has been created in our issue tracking system to investigate the issue. This thread has been linked with issue so that you may be notified once the issue will be fixed.