I want to use novacode-docx in cs-script. how can I give correct reference to the assembly. I tried following but didn't work around the assembly reference missing.
//css_reference D:\lib\DocX.dll;
using System;
using System.Diagnostics;
using System.Windows.Forms;
class Script
{
[STAThread]
static public void Main(string[] args)
{
using (DocX doc = DocX.Create(@"C:\Users\name\Desktop\test.docx"))
{
doc.PageLayout.Orientation = Orientation.Landscape;
var table = doc.AddTable(12, 2);
doc.InsertTable(table);
doc.Save();
}
}
}
You cannot reference an explicit path like that for presumably security reasons. The assembly must be placed in one of the following locations and referenced as
//css_reference DocX.dll;
See here for more info: http://www.csscript.net/help/using_.net_assemblies.html
Drop the Docx.dll into the same folder as where the cs script is and try this: