Compiler Error Message: BC30456: 'Where' is not a member of 'System.Collections.Generic.IEnumerable(Of DocumentFormat.OpenXml.Spreadsheet.Sheet)'.
On other pages the MS excel works fine so I doubt the .dll is borken or something.
if I replace the "where" with firstOrDefault or ElementAt(0) its the same error.
Imports System.Data.SqlClient
Imports System.Net.Mail
Imports DocumentFormat.OpenXml
Imports DocumentFormat.OpenXml.Packaging
Imports DocumentFormat.OpenXml.Spreadsheet
Imports System.IO
Partial Class BusinessLogic_Sent_Reminders
Inherits System.Web.UI.Page
Dim DA_Layer As New AFT_PPS_R2.DA_Layer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
Response.Buffer = True
'Open MS Excel template
Dim sourceBytes() As Byte = File.ReadAllBytes(Me.MapPath("~\TemplateDocs\Gddddd.xlsx"))
Dim ms As New MemoryStream
ms.Write(sourceBytes, 0, sourceBytes.Length)
Using myWorkbook As SpreadsheetDocument = SpreadsheetDocument.Open(ms, True)
Dim wbPart As WorkbookPart = myWorkbook.WorkbookPart
Dim sheet = wbPart.Workbook.Descendants(Of Sheet)().Where(Function(s) s.Name = "test").FirstOrDefault
Dim worksheetPart As WorksheetPart = DirectCast(myWorkbook.WorkbookPart.GetPartById(sheet.Id), WorksheetPart)
metalray
Member
106 Points
143 Posts
Problem with methods access of System.Collections.Generic.IEnumerable(Of DocumentFormat.OpenXml.S...
Jul 30, 2010 09:12 AM|LINK
Hi Guys,
I am gettings this compiler error:
Compiler Error Message: BC30456: 'Where' is not a member of 'System.Collections.Generic.IEnumerable(Of DocumentFormat.OpenXml.Spreadsheet.Sheet)'.
On other pages the MS excel works fine so I doubt the .dll is borken or something.
if I replace the "where" with firstOrDefault or ElementAt(0) its the same error.
Imports System.Data.SqlClient Imports System.Net.Mail Imports DocumentFormat.OpenXml Imports DocumentFormat.OpenXml.Packaging Imports DocumentFormat.OpenXml.Spreadsheet Imports System.IO Partial Class BusinessLogic_Sent_Reminders Inherits System.Web.UI.Page Dim DA_Layer As New AFT_PPS_R2.DA_Layer Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.ClearHeaders() Response.ClearContent() Response.Clear() Response.Buffer = True 'Open MS Excel template Dim sourceBytes() As Byte = File.ReadAllBytes(Me.MapPath("~\TemplateDocs\Gddddd.xlsx")) Dim ms As New MemoryStream ms.Write(sourceBytes, 0, sourceBytes.Length) Using myWorkbook As SpreadsheetDocument = SpreadsheetDocument.Open(ms, True) Dim wbPart As WorkbookPart = myWorkbook.WorkbookPart Dim sheet = wbPart.Workbook.Descendants(Of Sheet)().Where(Function(s) s.Name = "test").FirstOrDefault Dim worksheetPart As WorksheetPart = DirectCast(myWorkbook.WorkbookPart.GetPartById(sheet.Id), WorksheetPart)sansan
All-Star
53834 Points
8133 Posts
Re: Problem with methods access of System.Collections.Generic.IEnumerable(Of DocumentFormat.OpenX...
Jul 30, 2010 01:44 PM|LINK
see this one
List<string> str = new List<String>() { "a", "b", "c", "d" }; System.Collections.Generic.IEnumerable<string> en = str.AsEnumerable(); var result=en.Where(a => a == "c");Debug and see whats the type of the Descendants. try adding ToList() to that and see if it works.