Fast read and write excel file

SEUNGWOO NAM 1 Reputation point
2021-01-27T09:07:08.277+00:00

Hi.
I'm using a library,which is Xlnt library, to read and write excel file at MFC framework application.
Actually, in .NET(C#) framework, I easily use Microsoft.Office.Interop.Excel.Application to read and write excel file. It is very fast.

I have to convert .Net Framework application code to MFC Framework application. Because of conducting some reliability test( C# code makes a lot of extra fee, but C++ code is free).

How can I use something like Microsoft.Office.Interop.Excel.Application at MFC framework? It is performance over Xlnt Library ( 5 times faster ).

My excel file consists of 10,000 rows with 105 colums( but, almost are vacant. I use only 1~5 columns and 43~48 columns and 83~93 columns and 105 column). are there any technique to read and write some column segments to avoid full scanning all cells?

thank you for reading this. I'm looking forward to your answer.

Best regards.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,637 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 83,206 Reputation points
    2021-01-27T09:33:24.637+00:00

    How can I use something like Microsoft.Office.Interop.Excel.Application at MFC framework?

    With #import to generate interfaces

    Foir example for Office 16, I use :

    #import "C:\Program Files (x86)\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\mso.dll" rename("RGB", "MSRGB") rename("DocumentProperties", "WordDocumentProperties")
    #import "C:\Program Files (x86)\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" raw_interfaces_only, rename("Reference", "ignorethis"), rename("VBE", "testVBE")
    #import "C:\Program Files (x86)\Microsoft Office\root\Office16\Excel.exe" exclude("IFont", "IPicture") rename("RGB", "ignorethis"), rename("DialogBox", "ignorethis"), rename("VBE", "testVBE"), rename("ReplaceText", "EReplaceText"), rename("CopyFile","ECopyFile"), rename("FindText", "EFindText"), rename("NoPrompt", "ENoPrompt")
    

  2. Petrus 【KIM】 456 Reputation points
    2021-01-28T08:04:41.95+00:00