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

Free Support Forum - aspose.com

Loading external datas in a workbook

Hi !

I'm a new Aspose user and i search for techniques to inject data in a workbook, without having to programmaticaly work with cells.

My Excel model uses XML Mapping, but i didn't found any function to make it work with Aspose.Cells.

Can some one help me giving me an example working with aspose techniques ?

I would like to see code examples and Excel model examples.

Thank's

Christopher

Hi,

Well, I think if you have xml data and wants to import to Excel worksheet, you may get xml data to fill a datatable, then use Aspose.Cells’s Cells.ImportDataTable() method to get the data into the worksheet.

See the following sample code:
DataSet ds = new DataSet();
FileStream fs = new FileStream(“d:\test\xdata.xml”,FileMode.Open,FileAccess.Read);
StreamReader reader = new StreamReader(fs);
ds.ReadXml(reader);
fs.Close();

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells.ImportDataTable(ds.Tables[0],true,“A1”);

workbook.Save(“d:\test\xdatabk.xls”);

Moreover, please check number of ways to import external data into the worksheets using Aspose.Cells options:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/importing-data-to-worksheets.html

Thank you.

Hi Christopher,

You may also check the following link for better understanding of Aspose.Cells Object Model. It will help you in understanding "How Aspose.Cells creates a workbook and what is the hierarchy structure of its related objects".

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/aspose-cells-object-model.html

Thank's for these informations.

I was looking for a technique to potentialy use the same data source with different models of worksheets, without having to act programmaticaly.

For example, my source is a customer list with 20 colums in every row. I would like to use this datasource for

- générating a workbook that looks like a customer list (not all columns used)

- générating a workbook that looks like customer details, using more complex formatted forms.

And this, without programmation, the présentation work don in workbook conception.

PS : in your las message you say "the folowing link", but there's no link !

Thank's

Hi,

I think, if you want to minimize the codes, you should use Aspose.Cells’ Smart Marker feature. Using the feature, you may easily import data from your data sources, you need to just put some markers into the template file worksheet cells for your desired locations, the component would import data from the data source automatically based on the markers specified. The feature is more enhanced and you may use some parameters and grouping options for your requirements too.

For complete details, see the document for your reference:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/smart-markers.html

Thank you.