Overview

“XMindAPI for C#” consists out of 2 C# library files: XMindAPI.cs and ZipStorer.cs.  These are contained in project XMindAPI.LIB. The 2nd project XMindAPI.TestApp is a WPF test project that demonstrates some of the features of the XMindAPI. Both these projects are part of the XMindAPI solution that  that constitutes the source code download for this project.

 

XMindAPI.cs

  1. XMindWorkBook class -  Contains methods for creating the default file structures and manipulating diagram detail
    1. Constructor – Creates a new XMind workbook structure. The path and file name must be passed as argument. Note that if the file exists it will be overwritten when the Save() method is called.
    2. Sheet processing methods – AddSheet(), GetSheetIdsByTitle().
    3. Topic processing methods – AddCentralTopic(), AddTopic(), AddLabel(), AddMarker(), AddTopicLink(), EditTopicTitle(), GetTopicTitle(), GetTopicIdsByTitle(), GetTopicIdsByUserTagValue().
    4. Generic processing methods – AddUserTag(), GetUserTagValues(), Save().
  2. XMindStructure enum – Defines the type of diagram to be constructed. Refer AddCentralTopic() method.
  3. XMindMarkers enum – Defines the different pre-defined markers that can be applied to topics. Refer AddMarker() method.

For more in-depth documentation refer source code comments.

 

ZipStorer.cs

Refer http://zipstorer.codeplex.com

 

Workbook creation steps

  1. Create a new workbook by defining a new XMindWorkBook() object
  2. Add sheets, topics, labels, etc.
  3. Save the workbook (by calling the Save() method)

 

Diagram creation

Each sheet and topic are identified by a unique GUID id. The AddSheet() and AddTopic() methods return the GUID of the newly added sheet or topic for further processing. This is useful for example when adding a central topic to a sheet, or adding a sub topic to an existing topic.

 

User Tags

UserTags is a “future use” concept for adding user defined metadata to topics and sheets for back-end use – like database id’s, etc. The XMind application will not process or overwrite this information even if the topic/sheet containing the metadata gets modified through the XMind UI. In future versions of  “XMindAPI for C#” workbook modification will be implemented making it possible to programmatically modify previously generated workbooks. Previously added user tag metadata can then be accessing opening up all sorts of interesting programming possibilities to the API user. 

 

Example

The following figure shows the XMindAPI code with its output workbook opened in XMind side-by-side:

image

 
Steps for configuring a new MS Visual Studio project for XMindAPI use

  1. Create a new project (XMindAPI was successfully tested on a console and WPF project types)
  2. Target .NET Framework 2.0 or higher.
  3. Include ZipStorer.cs and XMindAPI.cs in the project.

 

 

References:

  1. XMind application download: http://www.xmind.net/
  2. XMind file structure: http://code.google.com/p/xmind3/wiki/XMindFileFormat
  3. Working with .zip files: http://zipstorer.codeplex.com 

Last edited Oct 28, 2012 at 12:19 PM by RudiRademeyer, version 14

Comments

julian50 May 21, 2015 at 9:08 AM 
Hello, your Api looks great. Are pictures supported ?