method G2antt.LoadXML (Source as Variant, [Flags as Variant])
Loads an XML document from the specified location, using MSXML parser.

TypeDescription
Source as Variant An indicator of the object that specifies the source for the XML document. The object can represent a file name, a URL, an IStream, a SAFEARRAY, or an IXMLDOMDocument.
Flags as Variant Specifies a numeric expression that defines which parts of the XML file should be ignored when loading data. Multiple flags can be combined using bitwise OR (|). 

The flags you can use are (numeric value only) : 

  • exXMLIgnoreDateFormat (0x0001, 1), Ignores the file's DateFormat setting. Defined by <DateFormat> tag.
  • exXMLIgnoreTimeFormat (0x0002, 2), Ignores the file's TimeFormat setting. Defined by <TimeFormat> tag.
  • exXMLIgnoreNumberFormat (0x0004, 4), Ignores the file's NumberFormat setting. Defined by <NumberFormat> tag.
  • exXMLIgnoreColumns (0x0008, 8), Ignores columns definitions. Defined by <Columns> tag.
  • exXMLIgnoreItems (0x0010, 16), Ignores items settings. Defined by <Items> tag.
  • exXMLIgnoreChart (0x0020, 32), Ignores chart definitions. Defined by <Chart> tag.

For example, LoadXML(..., 7) loads the data but ignores the file’s DateFormat, TimeFormat, and NumberFormat. You can use this approach when saving the file locally, as the date, time, and number formats will remain unchanged.

ReturnDescription
BooleanA boolean expression that specifies whether the XML document is loaded without errors. If an error occurs, the method retrieves a description of the error occurred. 
The LoadXML method uses the MSXML ( MSXML.DOMDocument, XML DOM Document ) parser to load XML documents, previously saved using the SaveXML method. The control is emptied when the LoadXML method is called, and so the columns and items collection are emptied before loading the XML document. The LoadXML method adds a new column for each <column> tag found in the <columns> collection. Properties like Caption, HTMLCaption, Image, Visible, LevelKey, DisplayFilterButton, DisplayFilterPattern, FilterType, Width and Position are fetched for each column found in the XML document. The control fires the AddColumn event for each found column. The <items> xml element contains a collection of <item> objects. Each <item> object holds information about an item in the control, including its cells, child items or bars. Each item contains a collection of <cell> objects that defines the cell for each column. The <bars> element contains a collection of <bar> each one is associated with the bars in the item. The Expanded attribute specifies whether an item is expanded or collapsed, and it carries the value of the ExpandItem property. The <chart> element contains data related to the chart data of the control. For instance, it includes the collection of levels being displayed in the chart, the first visible date, links and groups of bars. The <levels> element holds a collection of <level> objects each one being associated with an level in the chart area. The <links> element holds a collection of <link> objects each one indicating a link between two bars in the chart. The <groups> element holds a collection of <group> objects that indicates the bars that are grouped in the chart.

The XML format looks like follows:

- <Content Author Component Version ...>
	- <Chart FirstVisibleDate ...>
		- <Levels>
			  <Level Label Unit Count /> 
			  <Level Label Unit Count /> 
			  ...
		  </Levels>
		- <Links>
			  <Link Key StartItem StartBar EndItem EndBar Visible StartPos EndPos Color Style Width ShowDir Text ... /> 
			  <Link Key StartItem StartBar EndItem EndBar Visible StartPos EndPos Color Style Width ShowDir Text ... /> 
			  ...
		  </Links>
		- <Groups>
			  <Group ItemA KeyA StartA ItemB KeyB StartB /> 
			  <Group ItemA KeyA StartA ItemB KeyB StartB /> 
			  ...
		  </Groups>
	  </Chart>
	- <Columns>
		  <Column Caption Position Width HTMLCaption LevelKey DisplayFilterButton DisplayFilterPatter FilterType ... /> 
		  <Column Caption Position Width HTMLCaption LevelKey DisplayFilterButton DisplayFilterPatter FilterType ... /> 
		  ...
	  </Columns>
	- <Items>
		- <Item Expanded ...>
			  <Cell Value ValueFormat Images Image ... /> 
			  <Cell Value ValueFormat Images Image ... /> 
			  ...
			- <Bars>
				  <Bar Name Start End Caption HAlignCaption VAlignCaption Key ... /> 
				  <Bar Name Start End Caption HAlignCaption VAlignCaption Key ... /> 
				  ...
			  </Bars>
			- <Items>
			   - <Item Expanded ...>
			   - <Item Expanded ...>
			   ....
			  </Items>
		  </Item>
	  </Items>
  </Content>