Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to reference DLL component in C # code for QM2
#5
@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     Help - how to add the trigger to the macro
Code:
Copy      Help
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
Code:
Copy      Help
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")


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

Forum Jump:


Users browsing this thread: 1 Guest(s)