Free Support Forum - aspose.com

Selecting the First row in a GroupBy using Linq

I have been having an Issue trying to get this in Linq.

Context: I have a table on a document, If the object contains many rows of the same type I need to display a basic text stating that the data can be seen below in a different table, other wise show the single row of data per type. Pretty simple If statement and done. The problem I am having Is grouping and selecting the first one. I am receiving the following error:
An error has been encountered at the end of expression ’ TableRow row in Data.getRows().groupBy(x => x.getRowType()).select(g => g.first()).t’. Can not resolve method ‘select’ on type ‘interface asposewobfuscated.zzQU$zzW’.

How would I select the first entire Row object from each group to do my foreach on?

@Rohara239

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a simple Java application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.