Set Home| Set Favorite|

WPS Office Forum

 Forgot password?
View: 12739|Reply: 7

Kingsoft office automation

[ Promote this link! ]
Post time: 2013-07-22 01:10:39
| Show all posts |!read_mode!
Edited by anoop.menon at 2013-07-22 01:11


Let me first congratulate your team for awesome product.

Is there any API's availaible in Kingsoft office which could be used, to automate the document generation using .net (C#). It will be of great help if there is any documentation or libraries availaible for automating Kingsoft office on windows.

Thank you for helping me out.


Use magic Report

Post time: 2013-07-22 10:19:17
| Show all posts
Hi Anoop, Great suggestion about API's availaible.
 Author| Post time: 2013-07-22 16:56:32
| Show all posts
Hello Rain,

Where does it leave me ? Do we have any API's or at least can you provide me a sample code to show how to automate Kingsoft office?

Post time: 2013-09-05 18:03:29
| Show all posts
Hello, i created a Form and a Button in Visual Basic Express 2010 but it generates the error:  Cannot create ActiveX component.

This is my code in Visual Basic>

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim oExcel
        Dim oBook
        Dim oSheet

        'Start a new workbook in Kingsoft Presentation
        oExcel = CreateObject("et.Application")
        oBook = oExcel.Workbooks.Add

        'Add data to cells of the first worksheet in the new workbook
        oSheet = oBook.Worksheets(1)
        oSheet.Range("A1").Value = "Last Name"
        oSheet.Range("B1").Value = "First Name"
        oSheet.Range("A1:B1").Font.Bold = True
        oSheet.Range("A2").Value = "Doe"
        oSheet.Range("B2").Value = "John"

        'Save the Workbook and Quit Excel

    End Sub
End Class

This is the complete error:

System.Exception was unhandled
  Message=Cannot create ActiveX component.
       at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName)
       at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\Sistemas\documents\visual studio 2010\Projects\WindowsApplication1\WindowsApplication1\Form1.vb:line 10
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
Post time: 2013-09-06 18:53:43
| Show all posts
I developed Kingsoft Office Automatioon from Visual FoxPro 9

I changed the line

oExcel = CreateObject("et.Application")


oExcel = CreateObject("Ket.Application")

And Ran well!!!

Somebody can help me I inserted a Picture in a SpreadSheet but i want to set the property Move and Size with Cells to this picture. In Excel automation i write this code line:

loXlsApp.Selection.Placement = 1

What is the code line to do this in Kingsoft Office?

The complete code is:

miobj = loXlsApp.ACTIVESHEET.PICTURES.INSERT("P:\Image.jpg")
loXlsApp.Selection.Width = 100
loXlsApp.Selection.Height = 100
loXlsApp.Selection.Placement = 1

The last code line show error:
Ole Error Code 0x80020006: Unknown Name

Post time: 2014-01-18 23:25:32
| Show all posts
I have app in vb net, it made for Microsoft Excel. I Try to change Excel.Application to et.Application or Ket.Application but no results. Please help!!!Here is code:
   Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click


        Dim objXLApp As Excel.Application
        objXLApp = New Excel.Application

        With objXLApp

            Label1.Text = .Cells(1, 2).value
            Label2.Text = .Cells(1, 3).value
            Label3.Text = .Cells(1, 4).value
            Label4.Text = .Cells(1, 5).value
            Label5.Text = .Cells(1, 6).value
            Label6.Text = .Cells(1, 7).value
            Label7.Text = .Cells(1, 8).value
            Label8.Text = .Cells(1, 9).value
            Label9.Text = .Cells(1, 10).value
            Label10.Text = .Cells(1, 11).value
            Label11.Text = .Cells(1, 12).value
            Label12.Text = .Cells(1, 13).value

            TextBox1.Text = .Cells(2, 15).value
            TextBox2.Text = .Cells(3, 15).value
            TextBox3.Text = .Cells(4, 15).value
            TextBox4.Text = .Cells(5, 15).value
            TextBox5.Text = .Cells(6, 15).value

            If .Cells(1, 2).value = "" Then RadioButton1.Visible = False
            If .Cells(1, 3).value = "" Then RadioButton2.Visible = False
            If .Cells(1, 4).value = "" Then RadioButton3.Visible = False
            If .Cells(1, 5).value = "" Then RadioButton4.Visible = False
            If .Cells(1, 6).value = "" Then RadioButton5.Visible = False
            If .Cells(1, 7).value = "" Then RadioButton6.Visible = False
            If .Cells(1, 8).value = "" Then RadioButton7.Visible = False
            If .Cells(1, 9).value = "" Then RadioButton8.Visible = False
            If .Cells(1, 10).value = "" Then RadioButton9.Visible = False
            If .Cells(1, 11).value = "" Then RadioButton10.Visible = False
            If .Cells(1, 12).value = "" Then RadioButton11.Visible = False
            If .Cells(1, 13).value = "" Then RadioButton12.Visible = False
        End With

    End Sub
Post time: 2014-02-05 07:02:56
| Show all posts
bllinky replied at 2014-01-18 23:25
I have app in vb net, it made for Microsoft Excel. I Try to change Excel.Application to et.Ap ...


I can get a handle on Kingsoft spreadsheet via winforms as follows:
  1. Public Class Kingsoft_trial

  2.     Dim FileName As String
  3.     Dim myApp As Microsoft.Office.Interop.Excel.Application
  4.     Dim myWorkbook As Microsoft.Office.Interop.Excel.Workbook

  5.     Private Sub Button1_Click() Handles Button1.Click

  6.         With Me.OpenFileDialog1
  7.             .FileName = ""
  8.             .ShowDialog()
  9.             FileName = .FileName
  10.         End With

  11.         Me.WebBrowser1.Navigate(FileName)

  12.     End Sub

  13.     Private Sub WebBrowser1_Navigated() Handles WebBrowser1.Navigated

  14.         ' Get handle on spreadsheet application

  15.         myApp = Microsoft.VisualBasic.Interaction.GetObject(, "Ket.Application")

  16.         myApp.ActiveWorkbook.ActiveSheet.range("A1").value = "now it goes"

  17.         myApp.ActiveWorkbook.Save()

  18.         myApp.ActiveWorkbook.Close()

  19.         WebBrowser1.Update()

  20.     End Sub
Copy the Code
If Kingsoft is set as default application for .xls files, webbrowser control will open spreadsheet with Kingsoft.

You can verify via Task Manager that only Kingsoft application runs, not MS Excel (if installed).

Post time: 2015-05-28 15:28:23
| Show all posts
can i have a list of object that WPS spreadsheet dll have and its equivalent object to   
You have to log in before you can reply Login | Register

Points Rules

Dark room|Mobile|Archiver|WPS Office   

2017-07-24 14:31 GMT+8 , !processed_in! 0.079147 !seconds!, 10 !queries! .

Powered by Discuz! X3.2

Release 20151208, © 2001-2017 Comsenz Inc.

MultiLingual version, Rev. 469, © 2009-2017

!fastreply! To Top !return_list!