Skip to content

Make clipboard selection dimension properties available#720

Merged
appel1 merged 11 commits into
ExcelDataReader:developfrom
Sebastian-roko:clipboard
Apr 9, 2026
Merged

Make clipboard selection dimension properties available#720
appel1 merged 11 commits into
ExcelDataReader:developfrom
Sebastian-roko:clipboard

Conversation

@Sebastian-roko

Copy link
Copy Markdown
Contributor

For using ExcelDataReader to parse clipboard content, one missing information is the dimension of the selected data range.
This pull requests adds four properties to IExcelDataReader, which contain that dimension:

  • FirstRow (start row of selected data range)
  • LastRow (end row of selected data range)
  • FirstColumn (start column of selected data range)
  • LastColumn (end column of selected data range)

These properties are filled for binary xls/xlsb format and xlsx format.

@appel1

appel1 commented Sep 30, 2025

Copy link
Copy Markdown
Collaborator

What does this have to do with clipboard? Dimensions is about where there is content in the sheet, and it contains in many documents incorrect information which is why ExcelDataReader does not use it.

What is the intended use case for this?

@Sebastian-roko

Copy link
Copy Markdown
Contributor Author

When copying a range of data of an worksheet from Excel to the clipboard (e. g. with Ctrl+C), Excel saves an document to the clipboard containing only the data at the location of the selected data. For example, if you select the range D3:E4 and then press Ctrl+C, the clipboard will contain amongst others an Excel document in Biff12 format, where only the range D3:E4 is filled with values. To be able to find the copied data range, the mentioned properties are filled accordingly by Excel. In this example, FirstRow will be 3, LastRow will be 4, FirstColumn will be 4 and LastColumn will be 5. Therefore when loading this Excel document from the clipboard using ExcelDataReader, these properties contain the necessary information to determine the location of the copied data range.

@appel1

appel1 commented Oct 31, 2025

Copy link
Copy Markdown
Collaborator

I think this should be exposed as a Dimension property with a comment stating that it is unreliable. To make it clearer what it is.

And test cases.

@Sebastian-roko

Copy link
Copy Markdown
Contributor Author

I refactored the code to expose the clipboard-selection as property Dimension and added two tests (for Biff8 and Biff12).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants