문제

I am a complete beginner with DrawingML. I am trying to figure out if I can define a shape using the language, save it in some format and import it directly into a drawing canvas inside a Word document.

The motivation behind this is to enable users save an on-line generated graph as a file and import it into a canvas inside a Word document. The graph nodes should be connected so that when a node is dragged it will also mode the connector. My understanding is that it is possible to create such drawings using DrawingML but am not sure how to import such drawing into a document.

도움이 되었습니까?

해결책

You can create a Flat OPC XML file containing your DrawingML.

Then you add it to your docx open in Word. You can do that using VBA (a macro), or VSTO (a Word Add-In).

For more on Flat OPC XML, see http://blogs.msdn.com/b/ericwhite/archive/2008/09/29/the-flat-opc-format.aspx

You can add the Flat OPC XML using Range.InsertXml. See also Can I use VSTO instead of Open XML to manipulate altChunk features?

VSTO is a .NET thing. Generally you'd code in C# or VB.NET. You can use Microsoft's Open XML SDK as necessary. So Java doesn't usually have a role. Having said that, I do know of companies that are committed to Java server side and using docx4j there, and want to use the same technology client side, and so use docx4j IKVM'd as a DLL. In this context, that could be how you create your DrawingML (ie using JAXB), then produce the Flat OPC XML.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top