private void RunWps_Click(object sender, EventArgs e)
{
object myMissing = System.Reflection.Missing.Value;
WPS.Application WpsApp = new WPS.ApplicationClass();
WpsApp.Visible = true;
WpsApp.WindowState = WPS.WpsWindowState.wpsWindowStateMaximize;
WPS.Document WpsDoc = WpsApp.Documents.Add(ref myMissing, false, 1, true);
WpsDoc.Content.Text = "Hello World!";
WPS.Range myRange = WpsDoc.Range(0, 0);
WpsDoc.Paragraphs.Add(myRange);
WpsDoc.Range(0,0).Select();
WpsApp.Selection.Text = "欢迎你学习C#调用WPS";
}
C#调用WPS ET 转换pdf
先安装WPS
然后添加引用安装目录下的etapp.dll
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Collections;
using ET;
namespace ExcelToPdf
{
public void ConvertExcelToPDF(string xlspath,string pdfpath)
}
}
C#利用WPS生成Word文档:
-
首先服务器必须安装WPS Office
-
添加引用 -> COM -> Kingsoft WPS 2.0 Object Library
-
在.cs文件中添加 using KSO;和using WPS;
-
生成一个简单一个doc文件: