.NET
From Blue-IT.org Wiki
Programming MS Office in C# - Why?
There are a lot of complaints on not developing open source software on csharp (Stallman - Don't depend on mono). There might be or might be not an software patent issue with C# in future.
Unfortunately it is obvious, that a lot of software has to be developed for Microsoft Office out there. As a programmer addicted to document management, I can't ignore that. So I was looking around searching to get my work done without beeing bundled with Visual Studio ...
As long as Microsoft products are tight to C# in this way it is wise to use this programming language in a pragmatic manner. C# sharp has a lot of interesting features.
NetOffice
The Manufactor describes the advantages of developing for MS Office with its product in the following way:
Why NetOffice?The usual methods for accessing Microsoft Office. NET are the Primary Interop Assemblies and VSTO. Both access methods involve various disadvantages.
They are limited to a version, i.e. they only work with one or certain versions of Office They cause problems while transferring or installation on other systems They offer no protection mechanism in the management of COM proxies
NetOffice eliminates these disadvantages and remains a 1:1 wrapper that is syntactically and semantically identical to the interop assemblies.
CSharp
Shellscripts
Compiling an application
c:\Windows\Microsoft.NET\Framework\v3.5\csc.ext /t:exe /out:my.exe my.cs
Simple application example
using System; using System.Diagnostics; using System.ComponentModel; public class Script {
/// Add a shared network drive mapping /// </summary> /// <param name="uri">The drive letter (e.g. L:)</param> /// <param name="unc">The UNC path to the remote drive (e.g. \\MyServer\MyPrinter)</param> /// <param name="opt">Mount options (e.g. /persistent:yes /credsave)</param> static void MapNetworkDrive(string uri, string unc, string opt) { ProcessStartInfo pInfo = new ProcessStartInfo("net", "use " + uri + " " + unc + " " + opt); pInfo.CreateNoWindow = false; pInfo.UseShellExecute = true; pInfo.WindowStyle = ProcessWindowStyle.Hidden; Process RunIt = Process.Start(pInfo); RunIt.WaitForExit(5000); //give it some time to finish RunIt.Close();
}
static void Main() { MapNetworkDrive("Z:", "\\servername\share", "/savecred"); }
}