Saving worksheets to XPS- unable to open the XPS filee

Hello,

I have an excel workbook and I want to save to XPS format.

The file I create cannot be open on windows 7, I have not tested any other platform.

Here is the code I have (I don't want the first 3 worksheets.)

//Aspose version: 7.6.0.0

Aspose.Cells.Workbook worbook2 = new Aspose.Cells.Workbook(se_file_parsed);

// Make the sheet invisible
worbook2.Worksheets["Raw_Data"].IsVisible = false;
worbook2.Worksheets["Processing"].IsVisible = false;
worbook2.Worksheets["DataBase"].IsVisible = false;

XpsSaveOptions xpsSaveOptions = new XpsSaveOptions();
worbook2.Save(se_file_pdf, xpsSaveOptions);

Appreciate any help you maybe able to provide.

Regards,

Lewis

Hi Lewis,

Thank you for using Aspose products.

Your presented scenario could be template specific therefore we request you to please share your sample spreadsheet for our review. Moreover, if you can, please give a try to the latest build of Aspose.Cells for .NET 7.7.1.1 on your end to see if you still can reproduce the said problem.

Just updated to 7.7.1.1 as suggested, it is causing a lot of pain, I will work the new issues before returning to this thread.

The same issue exists with the latest driver, I have enclosed the template.


Here is the latest code I tried.
worbook.Worksheets[“Raw_Data”].IsVisible = false;
worbook.Worksheets[“Processing”].IsVisible = false;
worbook.Worksheets[“DataBase”].IsVisible = false;
//Apply different Image and Print options
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
//Set the Format
options.SaveFormat = SaveFormat.XPS;
Aspose.Cells.Rendering.WorkbookRender wr = new Aspose.Cells.Rendering.WorkbookRender(worbook, options);
wr.ToImage(se_file_xps);


The following are the issues I cannot resolve.
A readable XPS format and also when I update the ‘RAW_Data’ and save workbook. I can open that version on the filesystem, but cannot save the same workbook sheets with the latest changes.

How do I refresh the workbook with the saved changes?

I would appreciate any input you may have.

Hi Lewis,

Thanks for your posting and using Aspose.Cells.

Please download and use the latest version: Aspose.Cells for .NET v7.7.1.3 it is working fine. We have tested this issue with the latest version with the following code but we did not find any issue.

We have attached the output xps and screenshot for your reference. We have tested it on Windows 7.

C#


string filePath = @“D:\Downloads\Script_rev2_7.xlsx”;


Workbook worbook = new Workbook(filePath);


worbook.Worksheets[“Raw_Data”].IsVisible = false;

worbook.Worksheets[“Processing”].IsVisible = false;

worbook.Worksheets[“DataBase”].IsVisible = false;

//Apply different Image and Print options

Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();

//Set the Format

options.SaveFormat = SaveFormat.XPS;

Aspose.Cells.Rendering.WorkbookRender wr = new Aspose.Cells.Rendering.WorkbookRender(worbook, options);

wr.ToImage(filePath + “.out2.xps”);

Screenshot:

Hello,

Latest version loaded 7.7.1.4.

The XPS file is not getting created in my application with the update values in the excel file.

In the excel file which I update values into worksheet 'Raw_Data', if I save this to excel it is saved correctly on disk. If I continue to use this workbook object and save other sheets to this format, the new values are not displayed.

Also what is the correct way to print specific worksheets, with the API 'IsVisible' will this cause problems with the linked values?

Regards,

Lewis

Hi Lewis,

Thanks for using Aspose.Cells.

It is a correct way to hide your worksheets which you do not want to display in rendering of xps. It should not affect your linked values too.

Could you provide some sample project illustrating your issue and screenshots highlighting them? It will help us look into your issue more precisely and we will be able to help you asap.