Hi,
As I was trying to retrieve custom properties from an excel workbook using Aspose, I found an issue where I can not access the CustomXmlParts. The API reference does not mention any support for this either however on a forum post of the same topic, it was said that this has been fixed. ( Custom XML Parts )
I am currently using Aspose.Cells for .NET 8.3.1.
I have already done the same with Aspose.word and that works great but Aspose.cell says it contains no definition for customXMLPart.
Kindly advise how should I get this working for the current version.
with best regards,
Shahzad Naseem
Hi Shahzad,
Thanks for your posting and considering Aspose APIs.
Please provide us a runnable sample project showing the Custom XML parts usage with Aspose.Words. And also provide us some Excel file containing your Custom XML parts so that we could investigate this issue at our end.
In case, this feature needs to be supported, we will provide you a sample code how to implement it using Aspose.Cells.
Hi,
Thanks for your reply,
Aspose.words already has CustomXMLParts, here is the API reference, Custom Markup Features Supported on DOCX Import
Also this issue has been reported earlier and was later responded with a fixed reply with a reference to a release version (See the link in my previous post).
For your consideration, I will add a sample excel file containing custom XML parts, (they can be viewed by changing the file format to zip ).
Why I am confused here is, this is told to be already fixed in an earlier build but I cant use it with the latest version.
regards,
Shahzad
Hi Shahzad,
Thanks for your posting and using Aspose.Cells.
It seems, this feature is not supported as I cannot find any property relating to it in Workbook object. Could you please provide some sample Word doc just like you provided the Excel doc and Aspose.Words code to test this com.aspose.words.CustomXmlProperty class so that we could add a similar property in Aspose.Cells too.
Also, let me know how do you add Custom XML parts inside the Word or Excel document?
Thanks for your cooperation.
Hi,
One way to get custom properties is through saving documents into a sharepoint document library that requires some fields to be input through the office document information panel (Properties). While saving to the docu lib, MS office will prompt you if there are any required fields that are not input and the document info panel opens up.
To use the current implementation of customXMLparts with aspose.words, just create a document object and use custom XML parts like so:
Document doc = new Document(fileName);
var propertiesPart = doc.CustomXmlParts;
Then you can iterate through the custom parts and obtain the xml string from the part’s data property.
string xmlString;
foreach (CustomXmlPart p in propertiesPart)
{
xmlString = Encoding.UTF8.GetString(p.Data);
}
Then you are free to use the xml string for which ever purpose.
I will attach a sample word document as well for you, I hope this issue can be resolved soon as I need this direly for the current project.
Please do let me know if there is any eta on the addition of the feature to cells as I need to plan accordingly.
with best regards,
Shahzad Naseem
Hi Shahzad,
Thanks for your posting and considering Aspose.Cells.
We were able to retrieve custom xml parts from your word document using Aspose.Words. We will add a similar feature in Aspose.Cells, therefore we have logged a New Feature request in our database to support this issue.
We will look into it and implement it. Once, the feature is implemented or we have some other update for you, we will let you know asap.
This issue has been logged as
-
CELLSNET-43249 - Retrieve Custom Xml Parts from Workbook
I have also attached the Aspose.Words project retrieving Custom Xml Parts and screenshot highlighting this issue for a reference.
Hi,
Thank you very much for your help and assistance. I would like to ask you the estimated time frame for completion purely for planning purposes if that could be possible. A rough estimate would do as well. It would greatly ease my work.
With best regards,
Shahzad Naseem
Hi Shahzad.
Thank you for your patience.
Being a new feature, the ticket CELLSNET-43249 is currently pending for analysis and is in the queue with other priority tasks, We cannot estimate the time to release the implementation of your requested feature unless we have properly analyzed the said feature;s feasibility. We have now recorded a note for the concerned member of our team to schedule the ticket for analysis at earliest possible, and most preferably, provide an estimated release schedule. As soon as we receive any updates in this regard, we will post here for your kind reference.
Hi,
Thank you so much for your quick response. I really appreciate your assistance !
Have a great day,
Shahzad Naseem
Hi Shahzad,
Thank you for your patience with us.
Please use the Workbook.ContentTypeProperties property to parse the custom XML from the spreadsheet as demonstrated below.
C#
Workbook workbook = new Workbook(@“book1.xlsx”);
foreach (Aspose.Cells.Properties.ContentTypeProperty p in workbook.ContentTypeProperties)
{
Console.WriteLine(p.Name + " : " + p.Value);
}
Hi,
Thank you so much for the solution, I have successfully tested it and am very happy with it,
I wish you a great day!
regards,
Shahzad Naseem
Hi,
Good to know that it figures out your issue now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.
Thank you.