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.

Developer technologies | C++
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 90,686 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】 546 Reputation points
    2021-01-28T08:04:41.95+00:00

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.