C#呼叫wps
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
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 partial class Form1 : Form
{
int ifsucess = 0;
int iffail = 0;
int allcount = 0;
int num = 0;
public Form1()
{
InitializeComponent();
}
public void ConvertExcelToPDF(string xlspath,string pdfpath)
{
try
{
object type = System.Reflection.Missing.Value;
ET.ApplicationClass application = null;
ET.workbook book = null;
try
{
application = new ET.ApplicationClass();
book = (ET.workbook)application.Workbooks.Open(xlspath, type, type, type, type, type, type, type, type, type, type, type, type);
book.ExportPdf(pdfpath, "", ""); //this.GetFilePath(path)是獲取檔案路徑+檔名(不含字尾)
}
catch(Exception ex)
{
相關文章
- C#呼叫pydC#
- C#呼叫webserviceC#Web
- c#呼叫webservicesC#Web
- C#呼叫PythonC#Python
- C#呼叫外部DLLC#
- c#呼叫web serviceC#Web
- c#中呼叫ExcelC#Excel
- c# 反射呼叫方法C#反射
- xLua中C#呼叫LuaC#
- xLua中Lua呼叫C#C#
- C#呼叫C++DLLC#C++
- C#動態呼叫webserviceC#Web
- C#中委託的呼叫C#
- c# 呼叫.bat檔案C#BAT
- C#呼叫匯編dllC#
- C# 生成DLL 並 呼叫C#
- C#呼叫 C++的DLLC#C++
- CefSharp ——js呼叫c#方法JSC#
- c# 呼叫微吼直播APIC#API
- C# 呼叫Python程式碼C#Python
- C#中Emgucv呼叫HalconC#
- C#/.net程式呼叫pythonC#Python
- C#動態呼叫WCF介面C#
- C# 呼叫目標異常C#
- C# 呼叫*.sql第一種C#SQL
- 在c#中呼叫confirmC#
- c# 中呼叫COM元件 (轉)C#元件
- C#呼叫js庫的方法C#JS
- C#呼叫python的方法C#Python
- C# 反射呼叫擴充類方法C#反射
- C#中簡單的元件呼叫C#元件
- C#呼叫 oracle儲存過程C#Oracle儲存過程
- C#呼叫Windows API詳解(上)C#WindowsAPI
- C#呼叫Oracle儲存過程C#Oracle儲存過程
- C#委託的非同步呼叫C#非同步
- C++呼叫 c#生成的dllC++C#
- C#程式呼叫FFmpeg操作音視訊C#
- C# 生成隨機數,呼叫Random方法C#隨機random