Solid Edge Draft Type Library
ImportStyles2 Method
Solid Edge Draft Type Library > DraftDocument Object : ImportStyles2 Method
If bReplace is False, only styles that do not already exist will be copied.
Path of the source document.
Description
Copies styles of the specified type from the specified document. If bReplace is False, only styles that do not already exist will be copied.
Syntax
Visual Basic
Public Sub ImportStyles2( _
   ByVal StyleType As seStyleTypeConstants, _
   ByVal bReplace As Boolean, _
   ByVal pSrcDocument As Object _
) 
Parameters
StyleType
ValueDescription
igDimensionStyleDimension style.
igDrawingViewStyleDrawing view style.
igFillStyleFill style.
igHatchStyleHatch style.
igLineStyleLine style.
igTableStyleTable style.
igTextStyleText style.
bReplace
If bReplace is False, only styles that do not already exist will be copied.
pSrcDocument
Path of the source document.
Example
Imports System.Runtime.InteropServices

Public Class DraftAutomation

'#region ImportStyles
    Private Sub btnImportStyles_Click(sender As System.Object, e As System.EventArgs) Handles btnImportStyles.Click
        Dim objApplication As SolidEdgeFramework.Application = Nothing
        Dim objDraftDoc As SolidEdgeDraft.DraftDocument = Nothing
        Dim objDoc2 As SolidEdgeDraft.DraftDocument
        Dim objType As Type = Nothing

        Try
            objApplication = GetObject(, "SolidEdge.Application")

            If objApplication Is Nothing Then
                ' Get the type from the Solid Edge ProgID
                objType = Type.GetTypeFromProgID("SolidEdge.Application")
                ' Start Solid Edge
                objApplication = Activator.CreateInstance(objType)
                ' Make Solid Edge visible
                objApplication.Visible = True
            End If

            objDraftDoc = objApplication.ActiveDocument

            objDoc2 = objApplication.Documents.Open("C:\Program Files (x86)\Solid Edge ST6\Training\stddb3d.dft")

            Call objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igDimensionStyle, False, objDoc2)
            Call objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igLineStyle, False, objDoc2)
            Call objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igTableStyle, True, objDoc2)
            Call objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igFillStyle, True, objDoc2)
            Call objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igHatchStyle, True, objDoc2)
            Call objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igDrawingViewStyle, True, objDoc2)
            Call objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igTextStyle, True, objDoc2)

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

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

public class DraftAutomation
{

//#region ImportStyles
    private void btnImportStyles_Click(object sender, System.EventArgs e)
    {
        SolidEdgeFramework.Application objApplication = null;
        SolidEdgeDraft.DraftDocument objDraftDoc = null;
        SolidEdgeDraft.DraftDocument objDoc2 = null;
        Type objType = null;

        try
        {
            objApplication = Microsoft.VisualBasic.Interaction.GetObject(null, "SolidEdge.Application");

            if (objApplication == null)
            {
                // Get the type from the Solid Edge ProgID
                objType = Type.GetTypeFromProgID("SolidEdge.Application");
                // Start Solid Edge
                objApplication = Activator.CreateInstance(objType);
                // Make Solid Edge visible
                objApplication.Visible = true;
            }

            objDraftDoc = objApplication.ActiveDocument;

            objDoc2 = objApplication.Documents.Open("C:\\Program Files (x86)\\Solid Edge ST6\\Training\\stddb3d.dft");

            objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igDimensionStyle, false, objDoc2);
            objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igLineStyle, false, objDoc2);
            objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igTableStyle, true, objDoc2);
            objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igFillStyle, true, objDoc2);
            objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igHatchStyle, true, objDoc2);
            objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igDrawingViewStyle, true, objDoc2);
            objDraftDoc.ImportStyles2(SolidEdgeFramework.seStyleTypeConstants.igTextStyle, true, objDoc2);

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

    }
}
See Also

DraftDocument Object  | DraftDocument Members