@kevin
Thank you for your help
don't need this line of code:
x.SetOptions("references=C:\Users\Administrator\Desktop\GemBox.Document.dll")
copy the dll to qm program folder
C:\Program Files (x86)\Quick Macros 2
Package into exe, and put the EXE file and DLL in the same folder
Final code:
Macro M3
Trigger A3
For QM3 How to modify the relative path of reference DLL?
// script "doc_cs.cs" /*/ r C:\Users\Administrator\Desktop\GemBox.Document.dll; /*/ //.
How to use variables?
Macro Macro8
Thank you for your help
don't need this line of code:
x.SetOptions("references=C:\Users\Administrator\Desktop\GemBox.Document.dll")
copy the dll to qm program folder
C:\Program Files (x86)\Quick Macros 2
Package into exe, and put the EXE file and DLL in the same folder
Final code:
Macro M3
Trigger A3

CsScript x.AddCode("")
x.Call("Program.Main")
#ret
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(@"C:\Users\Administrator\Desktop\hello.docx");
,}
}
For QM3 How to modify the relative path of reference DLL?
// script "doc_cs.cs" /*/ r C:\Users\Administrator\Desktop\GemBox.Document.dll; /*/ //.
How to use variables?
Macro Macro8
str doc_path="C:\Users\Administrator\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")