The major problem is that default parameters will not be added into method call 
in winim/clr. You must specify them by yourself. Look into the source codes of 
DocX: 
    
    
    public static DocX Create( string filename, DocumentTypes documentType = 
DocumentTypes.Document )
    public override void Save( string password = "" )
    
    
    Run

Well, `Create` need an extra parameter _documentType_ , and `Save` need a 
_password_. So, here is the full code that works.
    
    
    import winim/clr
    
    var
      Words = load("Xceed.Words.NET.dll")
      Document = load("Xceed.Document.NET.dll")
      DocumentTypes = Document.GetType("Xceed.Document.NET.DocumentTypes")
      DocX = Words.GetType("Xceed.Words.NET.DocX")
    
    var doc = @DocX.Create("test.docx", @DocumentTypes.Document[DocumentTypes])
    # Using 0[DocumentTypes] may be easier, but you must know 
DocumentTypes.Document is 0
    
    var p = doc.InsertParagraph()
    p.Append("Hello World").Font("Arial Black")
    doc.Save("")
    
    
    Run

Reply via email to