Free Support Forum - aspose.com

AsposeData Table Manipulation

How to use AsposeDataTable for a table Data structure.Could anyone give some example on how to use this feature.

Our requirment is we will be having a set of headers and List of rows.Also how well it can be used with JavaBean.

Thanks

Joe

Hi,

Thanks for considering Aspose.

We will get back to you soon.

Thank you.

Hi Joe,

Please check the demos.

We change the smarter maker demo to show how to use AsposeDataTable and JavaBean.

Hi Warren,

Thank you very much for the examples.The problem we have is the table will be having dynamic headers and dynamic rows.What i mean is it can be determined only in runtime.So we cannot keep the fields in javaBean as static.It will be good for us if we can set a list of headers and list of columns inside the bean and retrieve it back same way as a property.

If you can provide us how we can achieve this will be great.As our template is dynamic in more ways one example is the column Headers will be different each and every time,so we need to get the array of headers and array of column data rows based on the Column Header we need to set the table.

Example:

Table Headers(String[] or Collection setter,getter in Bean)

Table Columns(String[] or Collection setter getter in Bean)

Thanks

Joe

Hi Joe,

Please check the demo of AsposeDataTable.

I think the AsposeDataTable will fit your need.

In the AsposeDataTable, we only get the cell value by the field name of the table with get(String columnName) and get(int columnIndex).

Yes it fits our requirement.but we want to keep only one column Header and one Column Data

The template will be like this
&=Headers(String[] or List of headers) will be 1…n Columns.
&=Columns(String[] or List of data) will be 1…n Rows.

Basically i was trying to keep setter and getter for this header and data array and want to set in the template.

I am not sure how to achieve this using AsposeDataTable.


Thanks



Hi,

In the smart marker demos, the DataTable class show how to use AsposeDataTable.

You can change it to fit your need. You can use your String[] or List of headers to replace the list in DataTable class.And re-implement the "get" methods.

Thank you.But is it possible to keep the String[] property of the Bean inside the template.Just like Mutivariable array and populate the values horizontal.

Example:

&=Employee.columnData(horizontal) //Only one variable

The variable will be in the first column of the starting data row. This will be populated for the total no.of rows of data based on the no.of columns.

public class Employee{

//String[] or List

private String[] columnData;

public void setColumnData(String[] columnData){

this.columnData=columnData;

}

public String[] getColumnData(){

return this.columnData;

}

}

Let me know your comments.

Regards

Joe

Hi,

Could you please let me know is it possible to include a bean array field using AsposeDataTable inside the template.If not possible how to achieve this.Please refer my previous post regarding the same.

Thanks

Joe

Hi Joe,

We do not support the value of the cell is array.

Do you mean that if the value of the property is array, it should be entir row/column data?

Yes,The value of the property is array.Let’s say to fill the entire row.How to achieve this using the bean and AsposeDataTable combination.We cannot keep static fields in each column of the cell with the Template.

I tried a lot to set the data.But doesn’t work.

Thanks
Joe


Hi Joe,

Please try this fix.

And please change your smart marker as &=Employee.columnData(bean,horizontal).

If you want to use Bean, please add "bean" property to smart marker ,or we will think the smart marker as the field of the table.

Thanks for your quick response.But this is not the real thing which i needed.Let me put it very clear.

In template there will be only one variable for all the rows(&=Employee.columnData).This variable will be present in the first row alone.

As far as the JavaCode concerned,The options can be like this,Somehow either Bean or AsposeDataTable should understand the collection.

The Collection will internally have the array of data for each row.Right now the options which is provided cannot be fit into a Dynamic Template as they are static.

I tried with the fix but unfortunately it sets the entire string array into a single cell.

Please let me know regarding this.As we cannot keep the template as static.

Thanks

Joe

Hi Joe,

Now we added support for two-dimension array in SmartMarker, attachment "sample.rar" is the template, sample code, and result file for demonstration, does it fit your need? If true, please try attatched fix. If not, please give us your sample code and template and the result file you expect, that will help us to get what you need actually.

Hi,

This is the sample.