Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to reference DLL component in C # code for QM2
#6
like this in qm
Code:
Copy      Help
str doc_path.expandpath("$Desktop$\test_doc.docx")
str code=
F
;using GemBox.Document;
;
;public class Program
;{{
,;public static void Main()
,;{{
,,;// If using Professional version, put your serial key below.
,,;ComponentInfo.SetLicense("FREE-LIMITED-KEY");
;
,,;DocumentModel document = new DocumentModel();
;
,,;Section section = new Section(document);
,,;document.Sections.Add(section);
;
,,;Paragraph paragraph = new Paragraph(document);
,,;section.Blocks.Add(paragraph);
;
,,;Run run = new Run(document, "Hello World!");
,,;paragraph.Inlines.Add(run);
;
,,;document.Save(@"{doc_path}");
,;}
;}

CsScript x.AddCode(code)
x.Call("Program.Main")

or c# way 
Code:
Copy      Help
CsScript x.AddCode("")
;x.SetOptions("references=$qm$\GemBox.Document.dll")
x.Call("Program.Main")


#ret
using GemBox.Document;
using System;

public class Program
{
,public static void Main()
,{
,,// If using Professional version, put your serial key below.
,,ComponentInfo.SetLicense("FREE-LIMITED-KEY");

,,DocumentModel document = new DocumentModel();

,,Section section = new Section(document);
,,document.Sections.Add(section);

,,Paragraph paragraph = new Paragraph(document);
,,section.Blocks.Add(paragraph);

,,Run run = new Run(document, "Hello World!");
,,paragraph.Inlines.Add(run);
,,
,,string docPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
,,document.Save(String.Format("{0}\\hello.docx" ,docPathPath));
,}
}


Messages In This Thread
RE: How to reference DLL component in C # code for QM2 - by Kevin - 01-06-2021, 06:13 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)