We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

loadSpreasheetMLFile for GridDesktop?

Hi,


I am evaluating Aspose Cells for .NET
I wish to develop a Windows Forms Application in which I can load/import, display/edit in a grid and save/export spreadsheetML docs (XML 2003)
According to your documentation the loadSpreasheetMLFile method is available only under your MainWeb WebWorksheets and GridWeb classes.
Is there a way with Aspose Cells for .NET to load a spreadsheetML file and display it in the GridDesktop control.
Alternatively can I use the GridWeb in a Windows Form? In VS2008 C#, it does not appear in the toolbox. I have only GridDesktop and FormulaBar.

Thanks for your help

Hi,


Thanks for your inquiry.

I am afraid, Aspose.Cells.GridDesktop does not support the feature (“load and save SpreasheetML(XML) file”). Also, you cannot use Aspose.Cells.GridWeb in a winform application. I have logged your requested feature with an id “CELLSNET-44004” for your issue. Our product team will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.

Hi Amjad,


Just to test, I tried the gridDesktop.ImportExcelFile() on xls, xlsx and … xml (2003), and surprise, it worked, even for the spreadsheetML document. It reproduced on the grid Desktop almost flawlessly the display in MS-Excel.

I also tried the ExportExcelFile() method. It has the option to save to .xls or to .xslx. It works nicely.

So, gridDesktop can load spreadsheetML into the grid, but it is not documented. Maybe if you check again, an undocumented way “save to spreadsheetML” is also possible :slight_smile:


Daniel

Hi,


Good to know that it is working fine for importing SpreadsheetML file into GridDesktop on your end. Well, I tried to load my sample SpreadsheetML file into GridDesktop and I got an error. Anyways, as we have already logged a ticket for the issue, we will check it out soon.

Thank you.

Hi,


It may help the community, so here is the C# code I used to evaluate the possibility of importing and exporting spreadsheetML files with the GridDesktop control:

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Aspose.Cells;

namespace AsposeEvalNet
{

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void openExcelFileButton_Click(object sender, EventArgs e)
{
String strImportFileName;

DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
strImportFileName = openFileDialog1.FileName;
String extn = Path.GetExtension(strImportFileName);
if (extn == “.xml” || extn == “.xls” || extn == “.xlsx”)
{
textBox1.Text = strImportFileName;
// loadSpreadSheetMLFile not available with Aspose gridDesktop but ImportExcelFile does the job (not documented)
gridDesktop1.ImportExcelFile(strImportFileName);
// A documented alternative could have been to create a workbook reading an Excel file (inc. spreadsheetML)
// in a tmp stream in memory and use ImportExcelFile to load the stream in the grid.
}
else
textBox1.Text = “MS-Excel file extension not supported (use .xml(2003) .xls .xlsx)”;
}
}

private void saveExcelFileButton_Click(object sender, EventArgs e)
{
Aspose.Cells.Workbook wbTemp;

DialogResult result = saveFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
MemoryStream ms = new MemoryStream();
gridDesktop1.ExportExcelFile(ms); // save workbook in grid as a temp stream in memory
wbTemp = new Workbook(ms); // create a new workbook reading the temp stream in memory
XlsSaveOptions savOpt = new XlsSaveOptions(SaveFormat.SpreadsheetML);
wbTemp.Save(saveFileDialog1.FileName, savOpt); // save the temp workbook as a spreasheetML file
}
}
}
}

Hi,


Thanks for your evaluation and the sample code.

Well, I tested and confirmed while reading template SpreadsheetML files and found that Aspose.Cells.GridDesktop does support to import/load SpreadsheetML file into its grid matrix. My earlier issue (I mentioned in my previous reply) actually occurred due to some other reason and the issue was not with the control. However, Aspose.Cells.GridDesktop did not support to have relevant enum member to save to SpreadsheetML (.xml file) format. We did log a ticket with an id “CELLSNET-44004” for your issue and we are pleased to inform you that we have now added FileFormatType.SpreadsheetML enum member to the GridDesktop.ExportExcelFile() overloads. Hopefully, the supported version would be available soon after we incorporate other enhancements and fixes.

Once we publish the next version, we will let you know here.

PS. We will also update the docs accordingly soon once we publish the release.

Thank you.


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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.