Hi,
Thanks for using Aspose.Cells.
Please try this sample code.
C#
DataTable dt = new DataTable();
dt = worksheet.Cells.ExportDataTable(0, 0, 1, 1, true);
dt.WriteXml(“out.xml”);
Hi,
Thanks for using Aspose.Cells.
Please try this sample code.
C#
Hi Shakeel,
Thanks for your reply.
I try your sample code and it can generate xml file for the cells you specified. Couple things I would like to check with you.
Thanks.
Hi,
Thanks for your query and using Aspose.Cells for .NET.
We will look into your questions and after investigation, we will help/advise you as soon as possible.
Hi,
1) If you want to get the area of xmlmap which is importing a xml file, we will give this method later.
2) You could try this code in DataTable:
dt.WriteXml(“D:\out.xml”,XmlWriteMode.WriteSchema);
and sorry about this,aspose did not has this feature now.
3) We will give the documents about xmlmaps later.
We now only support importing an xml file to excel like MS Excel.
Sample code:
Thanks Shakeel for your response. It will be useful if these features can be incorported with Aspose Cell product.
One more question related to this is GetRangeByName method. I want to ExportDataTable with the predefined range specified in excel instead of specifying first row, first column info in the code.
Specifically, I'm trying to using this method to get a name range that already defined in Excel template's Name Manager with below line of code:
Range MyRange = workbook.Worksheets.GetRangeByName("TestRange");
It doesn't work for me. MyRange will is null even my predefined range in Excel is correct.
If I create range at run time with a name then GetRangeByName, it can return the range.
Range range = worksheet.Cells.CreateRange("B6", "M10");
range.Name = "TestRange";
Range MyRange = workbook.Worksheets.GetRangeByName("TestRange");
My question is do we have to create range at run time in order to GenRangeByName? Does GetRangeByName method able to get the range that already defined in Excel? If yes, please let me know how.
Thanks.
Hi,
Thanks for your posting and using Aspose.Cells.
Please use the Workbook.Worksheets.Names property to retrieve all the named ranges in your workbook having workbook or sheet scope.
Please see the following sample code, source file and its output.
C#
Output:
------------------------------------
Refer To: =Sheet1!$B$1:$C$4
Text: LoginDetails
------------------------------------
Hi,
It looks like your above code sample or workbook.Worksheets.GetRangeByName("TestRange") will work if the name range is static. If the name range is dynamic, then it doesn't work for both methods.
Here is what I mean dynamic name range. In excel file, I have Xml Map imported. When I map the data in excel sheet, it creates table range under Formulas -> name manager. When user continue insert data in the mapped table, the name range change dynamically.
Thanks.
Hi,
Thanks for your feedback and considering Aspose.Cells.
Could you please create a sample runnable application and screenshots elaborating your issue more?
We will look into it and help you asap.
Hi,
Please see attached sample excel file and screen shot for the dynamic name range and static name range. Your sample code or workbook.Worksheets.GetRangeByName("StaticRange") works for the static range. But fail with Dynamic range like workbook.Worksheets.GetRangeByName("BookTableRange"). Let me know if you can get the dynamic range work.
Thanks.
Hi,
Thanks for your screenshot and elaborating this issue.
Please use workbook.Worksheets.GetNamedRangesAndTables() method, it will give you desired results.
Please see the following screenshot for your reference.
Screenshot:
Hi, thanks a lot!
This method works for both static and dynamic range.
Hi,
Thanks for your feedback.
It’s good to know that GetNamedRangesAndTables() method works for your both cases.
Let us know if you face any other issue, we will be glad to assist you further.
Hi guys
Hi,rickd-1:
Hi guysI read on Stack Overflow that export to XML (map) could be supported in 2nd or 3rd quarter this year.We are currently evaluating Aspose.Cells and this is a key feature requirement for us. Any update on pending availability of this feature?Thanks,Rick
Hi Aspose
Can you tell me if you are supporting XML Mapping Import functionality from Excel Developer tab (please see attached print screen for more details) If yes how this can be achieved in C# - example code would be nice
To be more specific below you can find Office Excel Interop example:
Microsoft.Office.Interop.Excel.Application application = new Microsoft.Office.Interop.Excel.Application();
application.Workbooks.Open("C:\\test\\exceltemplate-with-xmlmapping.xslx");
Microsoft.Office.Interop.Excel.XmlMap map = application.ActiveWorkbook.XmlMaps[1];
application.ActiveWorkbook.XmlImportXml("<data><value1>1</value1><value2>2</value2></data>", out map);
application.ActiveWorkbook.SaveAs("c:\\test\\excel-with-xmldata.xlsx");
application.Workbooks.Close();
Best regards
Peter
Hi Piotr,
Thanks for your elaboration and considering Aspose.Cells.
We understand your requested feature and logged it in our database as a New Feature request in our database to support it. Hopefully, we will be able to implement it. And in case it is already implemented, we will provide you a sample code. Once there is some news for you, we will update you asap.
This issue has been logged as
Shakeel,
I am also most interested in the progress of this feature. Could you please provide a hyperlink to the status of this new issue? Or is this thread the place where I can expect to be updated?
Thanks,
John
Hi John,
Thanks for your question and considering Aspose.Cells.
You can check this thread for updates. Or else if you like to create your own thread, we will link that thread to same issue (CELLSNET-43992) and you will get automatic notification in that thread too. We have also added your comment in our database against this issue for product team consideration. Once, there is some news for you, we will update you asap.
I’m tracking this thread too
Hi,
Thanks for your posting and considering Aspose.Cells.
We have also logged your comment in our database against this issue and informed the product team about your interest in this feature. Once, there is some update for you, we will let you know asap.