Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7903317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:43:06+00:00 2026-06-03T09:43:06+00:00

I want to imeplement something as shown below in my c++ application c++/cli application.

  • 0

I want to imeplement something as shown below in my c++ application c++/cli application. I am using visual studio 2010.

static void ReadExcelFileDOM(string fileName)
{
    using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(fileName, false))
    {
        WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
        WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();
        SheetData sheetData = worksheetPart.Worksheet.Elements<SheetData>().First();
        string text;
        foreach (Row r in sheetData.Elements<Row>())
        {
            foreach (Cell c in r.Elements<Cell>())
            {
                text = c.CellValue.Text;
                Console.Write(text + " ");
            }
        }
        Console.WriteLine();
        Console.ReadKey();
    }
}

I proceeded as below:

#include "stdafx.h"
#define S DocumentFormat::OpenXml::Spreadsheet::Sheets
#define Sheetdata DocumentFormat::OpenXml::Spreadsheet::SheetData
#define Wsheet DocumentFormat::OpenXml::Spreadsheet::WorkbookPart::WorksheetPart
#define E DocumentFormat::OpenXml::OpenXmlElement
#define As DocumentFormat::OpenXml::OpenXmlAttributes
#define A DocumentFormat::OpenXml::OpenXmlAttribute
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Linq;
using namespace System::IO;
using namespace System::Text;
using namespace System::Diagnostics;
using namespace DocumentFormat::OpenXml;
using namespace DocumentFormat::OpenXml::Packaging;
using namespace DocumentFormat::OpenXml::Spreadsheet;
int _tmain(int argc, _TCHAR* argv[])
{
    DocumentFormat::OpenXml::Packaging::SpreadsheetDocument^ mySpreadsheet = SpreadsheetDocument::Open("sample.xlsx", false);
    WorkbookPart^ wp = mySpreadsheet->WorkbookPart;//
    IEnumerable<Sheet>^ sheets = wp->GetFirstChild<Sheet>().Elements<Sheet>();

    return 0;
}

The build fails with following errors:

1>clitest.cpp(33): error C3225: generic type argument for 'T' cannot be 'DocumentFormat::OpenXml::Spreadsheet::Sheet', it must be a value type or a handle to a reference type
1>clitest.cpp(33): error C2039: 'GetFirstChild' : is not a member of 'DocumentFormat::OpenXml::Packaging::WorkbookPart'
1>          c:\program files (x86)\open xml sdk\v2.0\lib\documentformat.openxml.dll : see declaration of 'DocumentFormat::OpenXml::Packaging::WorkbookPart'
1>clitest.cpp(33): error C2059: syntax error : ')'

Please if someone could help me on this. I am heldup on this issue.

Regards
strong text

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:43:08+00:00Added an answer on June 3, 2026 at 9:43 am

    The generic types need to be of a class reference type.

    IEnumerable<Sheet^>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for iOS 5.0 using ARC, here is something I want to implement and need
I want to implement something like Col3 = Col2 + Col1 in SQL. This
I want to implement something with jquery, simple javascript and java but I don't
I want to implement something simple like /System/Workflows/Sample Workflow with the small addition of
I am learning OOP with python. I want to implement something like to display:
i want to implement a dynamic relation mechanism with python something like: a:=10 b:=30
I want to do something like this: I tried to implement it by myself
I'm writing an application in WPF using the MVVM-pattern and will really often use
I want to implement something exactly like Changing the Default Text in the Search
I often want to write something like this: new Form { Text = Caption,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.