none
Different part name between Excel and Open-XML-SDK RRS feed

  • Question

  • When I call the function WorksheetPart.AddNewPart<DrawingsPart>, the result part filename is /xl/drawings/drawing.xml, which is different from what Excel 2013 names it (/xl/drawings/drawing1.xml). Note the "1". This wouldn't matter, except that the Open XML SDK 2.5 Productivity Tool for Microsoft Office won't compare DrawingsPart s created the two different ways.

    What's causing this is that line 7719 of DocumentFormat.OpenXml\src\GeneratedCode\package.cs returns the TargetNameConstant which lacks the "1":
    internal const System.String TargetNameConstant =@"drawing";

    There's a similar issue for part /xl/worksheets/sheet1.xml on lines 9891 & 9897 of the same package.cs file:
    internal const System.String TargetNameConstant =@"sheet";

    I need to control the name of the DrawingsPart so the Productivity Tool can generate Open-XML-SDK code for me to use in my program. Can you help me? If this requires a change to the Productivity Tool, I have other ideas for enhancements too.

    Howard Rubin

    Friday, November 18, 2016 10:17 PM

All replies

  • Hi Howard Rubin,

    from the description of the thread it looks like your issue is related with Open XML SDK 2.5 Productivity Tool itself.

    like you had mentioned that if you try to add new part it produces the "drawing1.xml".

    did you check that on that location "drawing.xml" is already available? or not.

    it is possible that if file is available then it add the "1" in new file name.

    in other issue you had mentioned that,"Open XML SDK 2.5 Productivity Tool for Microsoft Office won't compare DrawingsPart s created the two different ways."

    this issue is related with tool itself.

    we can't modify or change the way of working of tool.

    here you need to think about work around that can solve your issue.

    we can't control how it works. we just try to code to achieve our desired requirement.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 21, 2016 10:01 AM
    Moderator