Databinding in Aspose.Grid.Desktop


#1

I’ve searched the forum and checked the documenation/samples and have found very little information on databinding with the desktop version of the grid. It would be greatly appreciated if someone could point me in the proper direction on this, as we are evaluating the product right now and I need to throw together a quick screen, using an Excel spreedsheet as the template and pulling data from a database.

TIA
John


#2

Hi,

Thank you for considering our product!

You can use ImportExcelFile to import an excel spreedsheet as the template. And then use ImportDataTable to pull data from database. For example:

gridDesktop.ImportExcelFile(@"c:\book1.xls");
Worksheet sheet = gridDesktop.Worksheets[0];
DataTable dt = new DataTable();
this.oleDbSelectCommand1.CommandText = @"SELECT DISTINCTROW Products.ProductName,
Categories.CategoryName,
Products.QuantityPerUnit,
Products.UnitsInStock
FROM Categories INNER JOIN Products
ON Categories.CategoryID = Products.CategoryID
WHERE
(((Products.Discontinued) = No))
Order by Products.ProductName";
this.oleDbDataAdapter1.Fill( dt );
sheet.ImportDataTable(dt, false, 0, 0);

for (int i = 0; i < dt.Columns.Count; i++)
{
sheet.ColumnsIdea [I].Header = dt.ColumnsIdea [I].Caption;
}

The DataBind function imports data starting with "A1" cell only. And when you change data in the cell, the DataTable object will be changed at the same time.

The ImportDataTable function allows specifying the starting cell position.


#3

Nick,

Thanks for the quick reply but…

Does this mean that the grid does not work with the Smart Markers?
If that is the case, am I looking at the wrong product?

What I am trying to do for this test is as follows:
Create a template spreedsheet, with field labels, Smart Markers (or some form of replacement indicator to allow for data from a database to be inserted in it’s place), and formulas. The formulas could be added or updated by the user, along with additional static data.

Is the grid the correct product? Or do I need some combination of the products?

TIA
John


#4

Hi,

Aspose.Cells supports the Smart Markers feature. You can use Aspose.Cells and Aspose.Grid.

Thanks


#5

Nick,

I have not been able to locate anything in the documenation and/or samples regarding using the Smart Markers with the Aspose.Grid.Desktop. Can you point me in the direction where this information is located?

Thanks!
John


#6

Hi,

The Aspose.Grid.Desktop doesn't support the Smart Markers feature. Aspose.Cells supports it.