Solid Edge Framework Type Library
ExportMaterialDataToFile Method
Specify Material Library Name as string.
Specify path of XML or XLSX file as string.
Description
Writes out all the material data of input material library into XML or EXCEL file.
Syntax
Visual Basic
Public Sub ExportMaterialDataToFile( _
   ByVal bstrMaterialLibraryName As String, _
   ByVal bstrXMLFile As String _
) 
Parameters
bstrMaterialLibraryName
Specify Material Library Name as string.
bstrXMLFile
Specify path of XML or XLSX file as string.
Example
Imports System.Runtime.InteropServices

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim objApp As SolidEdgeFramework.Application = Nothing
        Dim objType As Type = Nothing
        Dim objMatTable As SolidEdgeFramework.MatTable = Nothing
        Dim strMaterialFolderPath As String = ""
        Dim strLibrary As String = "Materials"
        Dim varPropList As Object = Nothing

        Try
            ' Get SE handle
            objApp = Marshal.GetActiveObject("SolidEdge.Application")

            If objApp Is Nothing Then
                ' Get the type from the Solid Edge ProgID
                objType = Type.GetTypeFromProgID("SolidEdge.Application")
                ' Start Solid Edge
                objApp = Activator.CreateInstance(objType)
                ' Make Solid Edge visible
                objApp.Visible = True
            End If
            ' Get material table object handle
            objMatTable = objApp.GetMaterialTable()

            Dim strXMLLibraryPath As String = "C:\Temp\Materials_Exported.xml"

            objMatTable.ExportMaterialDataToFile(strLibrary, strXMLLibraryPath)

        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

    End Sub

End Class
using System.Windows.Forms;
using System.Runtime.InteropServices;

public class Form1
{

    private void Button1_Click(object sender, EventArgs e)
    {
        SolidEdgeFramework.Application objApp = null;
        Type objType = null;
        SolidEdgeFramework.MatTable objMatTable = null;
        string strMaterialFolderPath = "";
        string strLibrary = "Materials";
        object varPropList = null;

        try
        {
            // Get SE handle
            objApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

            if (objApp == null)
            {
                // Get the type from the Solid Edge ProgID
                objType = Type.GetTypeFromProgID("SolidEdge.Application");
                // Start Solid Edge
                objApp = Activator.CreateInstance(objType);
                // Make Solid Edge visible
                objApp.Visible = true;
            }
            // Get material table object handle
            objMatTable = objApp.GetMaterialTable();

            string strXMLLibraryPath = "C:\\Temp\\Materials_Exported.xml";

            objMatTable.ExportMaterialDataToFile(strLibrary, strXMLLibraryPath);

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }

    }


    public Form1()
    {
        SubscribeToEvents();
    }

    private bool EventsSubscribed = false;
    private void SubscribeToEvents()
    {
        if (EventsSubscribed)
            return;
        else
            EventsSubscribed = true;

        Button1.Click += Button1_Click;
    }

}
See Also

MatTable Object  | MatTable Members