Share via

create spreadsheet using Win32 api

Anonymous
2012-03-23T09:17:04+00:00

I have a program that outputs some results. I would like to add this facility:

  • customers launch it and get a new set of results
  • the results are compared with a base set
  • the curve is presented in an excel file

The program is written in C. Is there a way to generate a spreadsheet on the fly?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2012-03-27T01:49:27+00:00

    Hello,

    As you said, VBA is installed with Office. But it is hard to generate a document on a PC that does not have Office installed. That is: It depends on the Excel components (COM Components) to generate an Excel document unless you understand Excel file storage formats.

    Cheers,

    Cristin

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-03-26T09:26:54+00:00

    Hi,

    thank you for taking the time to answer this question. Most likely, VBA is installed with Office. What I want is to generate the document on the fly on a machine that does not have Office installed.

    It is not  a critical feature for the product.

    Regards,

    Calin

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-03-26T05:49:52+00:00

    Hi,

    It's hard to create a spreadsheet using Windows APIs in C programming language.

    But it's more convenient if you use Office runtime libraries, see below example using VBS:

        Dim xlApp

        Dim xlWb

        Set xlApp = CreateObject("Excel.Application")

        xlApp.Visible = False

        Set xlWb = xlApp.Workbooks.Add

        Set xlSht = xlWb.Worksheets.Add

        xlSht.Cells(1, 1) = "This is Cell A1"

        xlWb.SaveAs ("D:\newSheet.xlsx")

        xlApp.Quit

    Assuming that you have copied the above code to Notepad and saved it as "xxx.vbs", then you can double-click the file and see a new spreadsheet will be generated in "D:" directory.

    Cheers,

    Cristin

    Was this answer helpful?

    0 comments No comments