Free Support Forum -


I was wondering if it was possible to convert a DataView into a DataTable since the ExecuteDataTable in Aspose.Word only returns a DataTable. I tried something like Dim x as DataTable=CType(dataview, DataTable) but to no avail. The reason I need this is because I want to perform a RowFilter method on a DataView (that will give me a subset of the data that i’m looking for in the DataTable) and pass that information along to a DataTable and subsequently to the ExecuteDataTable method. Then I want to add all these dataviews (or ‘filtered datatables’) into a dataset for later processing (each dataview will have it’s own unique filtering criteria). Is this possible? Thank you for your time.

By the way, the product (Aspose.Word) works great.


Thank you for considering Aspose.

Could you please explain what finally do you need to achieve? If you want to use Execute or ExecuteWithRegions, they accept both DataTable and DataView, no need to perform the conversion.

Hi DmitryV,

Ultimately, I want to use a dataset (ds) within the ExecuteWithRegions method. But before I do that I want to add a bunch of datatables to the ds using ds.Tables.Add(dt1), ds.Tables.Add(dt2), ds.Tables.Add(dt3), ds.Tables.Add(dt…). However, I want to filter the contents of dt1, dt2, dt3, etc… before I add them to the Tables collection of the dataset and the only way I can see doing that is by using the DataView of the DataTable, then using the dataview’s RowFilter, and then somehow converting the filtered records of the dataview back to a datatable so I can add them to ds.Tables.

Hope I didn’t further confuse you.

Thanks for the explanation, although your problem is not directly related to Aspose.Word Smile Well, it’s impossible to convert filtered DataView to DataTable using just one line of code because .NET Framework does not provide any method for this. This could be considered as a gap. There’re lots of the solutions in the Internet, see here for example:

Thanks DmitriV. The link you provided is a start. I’ll try it out and see how it goes. Your prompt replies to my inquiries is much appreciated.