Bug 127675 - Pasting only 65536 rows / 256 columns / 255 characters per cell to Calc from Excel (missing support for BIFF12 clipboard format)
Summary: Pasting only 65536 rows / 256 columns / 255 characters per cell to Calc from ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Windows (All)
: medium normal
Assignee: Laurent Balland
URL:
Whiteboard: reviewed:2023 target:26.2.0 target:26...
Keywords: difficultyMedium, easyHack, skillCpp
: 87843 163759 (view as bug list)
Depends on:
Blocks: Paste-From-MSO
  Show dependency treegraph
 
Reported: 2019-09-20 16:55 UTC by Roman Kuznetsov
Modified: 2026-02-02 15:56 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Example XLSX with 100000 rows with data (817.30 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2019-09-20 16:56 UTC, Roman Kuznetsov
Details
Screencast (1.99 MB, image/gif)
2026-02-02 04:23 UTC, Mike Kaganski
Details
Screencast with five cells (1.04 MB, image/gif)
2026-02-02 09:44 UTC, Mike Kaganski
Details
Video showing exact steps for getting Calc hang after copy paste from Excel (10.40 MB, video/webm)
2026-02-02 12:04 UTC, devseppala
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Kuznetsov 2019-09-20 16:55:36 UTC
Description:
Pasting only 65536 rows to Calc from Excel

possible a problem with selecting of right format for pasting from clipboard in LibreOffice Calc

Steps to Reproduce:
1. Open XLSX file from attach
2. Copy cell range A1:A100000
3. Try paste it into Calc => will be paste only 65536 rows instead of all 100000


Actual Results:
Pasting only 65536 rows to Calc from Excel

Expected Results:
Pasting all data from Excel to Calc


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.4.0.0.alpha0+ (x64)
Build ID: 06925c1230cd6269fa5189ac3f4d608c9edf68e9
CPU threads: 4; OS: Windows 10.0; UI render: GL; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-09-17_00:45:28
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded
Comment 1 Roman Kuznetsov 2019-09-20 16:56:36 UTC
Created attachment 154330 [details]
Example XLSX with 100000 rows with data
Comment 2 Roman Kuznetsov 2019-09-20 16:58:14 UTC
Open file from attach in Excel of course =(
Comment 3 Mike Kaganski 2019-09-20 17:12:20 UTC
Excel (tested with ver.2016) stores these formats to clipboard:

CF_TEXT
CF_BITMAP
CF_METAFILEPICT
CF_SYLK
CF_DIN
CF_UNICODETEXT
CF_ENHMETAFILE
Embed Source
Link Source
Object Descriptor
Link Source Descriptor
HTML Format
Rich Text Format
Hyperlink
Csv
Link
Biff8
Biff5
XML Spreadsheet
Biff12

The Biff8 is what is chosen by Calc when pasting (see ScViewFunc::PasteFromSystem()). It is a format that is limited to 256 columns and 65536 rows, hence it can't contain everything that Excel is capable to store to clipboard (Biff5 has the same constraints). "XML Spreadsheet" format seems to be the Excel 2003 XML format; and Biff12 is "Excel Binary Workbook" (.xlsb), which is the format supported by LibreOffice (read-only) and doesn't have the limitation of the older Biff formats.

The Biff8 clipboard format support was added in commit https://git.libreoffice.org/core/+/f5412bb121481cf1e48af4d6dc10674bec6c095c.

Adding "easyhack" keyword.
Comment 4 Mike Kaganski 2019-09-20 17:24:16 UTC
So the idea is to add the Biff12 Clipboard format support, which would take precedence over the other two Biff formats on import.
Comment 5 Hossein 2023-04-06 09:51:12 UTC
Re-evaluating the EasyHack in 2023

This issue is still relevant. I've tested this with MS Office 2019 and both LO 7.5 and the latest LO 7.6 dev master, and the problem is still there:

Version: 7.5.1.2 (X86_64) / LibreOffice Community
Build ID: fcbaee479e84c6cd81291587d2ee68cba099e129
CPU threads: 32; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (en_DE); UI: en-US
Calc: threaded

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 23bd3bd10e74b0c23c2654d02d7d830e7693adac
CPU threads: 32; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (en_DE); UI: en-US
Calc: threaded
Comment 6 Mike Kaganski 2023-05-09 10:44:34 UTC
*** Bug 87843 has been marked as a duplicate of this bug. ***
Comment 7 Matt K 2023-07-09 00:21:32 UTC Comment hidden (off-topic)
Comment 8 Mike Kaganski 2023-07-09 06:16:19 UTC Comment hidden (off-topic)
Comment 9 Matt K 2023-07-09 22:39:11 UTC Comment hidden (off-topic)
Comment 10 Mike Kaganski 2024-11-04 13:24:33 UTC Comment hidden (obsolete)
Comment 11 Mike Kaganski 2024-11-04 18:34:43 UTC
*** Bug 163759 has been marked as a duplicate of this bug. ***
Comment 12 Commit Notification 2025-11-16 15:06:23 UTC
Laurent Balland committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ba49c9249fcfec8891ef7d53dc8c9db1715df020

tdf#127675 Treat Biff12 when pasting

It will be available in 26.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 devseppala 2025-12-23 10:52:38 UTC
(In reply to Commit Notification from comment #12)
> Laurent Balland committed a patch related to this issue.
> Affected users are encouraged to test the fix and report feedback.

I tested this by copying a range consisting of 120k rows, 340 columns from Excel 2013 to Calc 26.2.0.0.beta1. First row had cells with 700 charachters and other cells in columns had numbers 1,2,3,4,5...120000. Pasting took maybe 20 seconds and seems to have worked fine. 

Thank you very much for fixing this issue! I think the 256 characters per cell limit was most annoying and dangerous, because it was so difficult to detect the missing characters. With rows and colums it was easier see that not all of the rows or columns were transfered.  


Version: 26.2.0.0.beta1 (X86_64)
Build ID: 620(Build:0)
CPU threads: 16; OS: Windows 11 X86_64 (build 26200); UI render: Skia/Vulkan; VCL: win
Locale: fi-FI (fi_FI); UI: en-GB
Calc: CL threaded
Comment 14 devseppala 2025-12-23 11:33:37 UTC
(In reply to Commit Notification from comment #12)
> Laurent Balland committed a patch related to this issue.
> Affected users are encouraged to test the fix and report feedback.

In my previous comment I concluded that I managed succesfully copy/paste BIFF12 data from Excel 2013 to Calc 26.2.0.0.beta1. 

Now I find that saving the .ods document that I pasted data from Excel 2013 always crashes. Even with very small content pasted. Does this happen to anyone else?

Saving a naturally created LO calc document with 120k rows, 350rows  and some cells having 700 works. Working with this huge document does get into some performance issues, but saving it does work.
Comment 15 Buovjaga 2025-12-23 11:42:42 UTC
(In reply to devseppala from comment #14)
> In my previous comment I concluded that I managed succesfully copy/paste
> BIFF12 data from Excel 2013 to Calc 26.2.0.0.beta1. 
> 
> Now I find that saving the .ods document that I pasted data from Excel 2013
> always crashes. Even with very small content pasted. Does this happen to
> anyone else?

Please create a new report for it with a minimal sample that reproduces the issue.
Comment 16 devseppala 2025-12-23 11:59:36 UTC
(In reply to Buovjaga from comment #15)
> (In reply to devseppala from comment #14)
> Please create a new report for it with a minimal sample that reproduces the
> issue.

@Buovjaga, producing a sample document is a bit difficult as the saving process crashes and hangs, and I have to manually end the LO process. Thus there is no document to send.

I will do a new report on the subject little later.
Comment 17 Mike Kaganski 2025-12-23 12:05:54 UTC
Reproducible; no sample nor new report needed. I will fix the implementation.
Comment 18 Mike Kaganski 2025-12-23 12:17:33 UTC
https://gerrit.libreoffice.org/c/core/+/196161
Comment 19 Commit Notification 2025-12-23 14:02:24 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a616d6f20f95735d4db4af1c102b40c9c98c2080

tdf#127675: SfxObjectShell::DoLoad takes ownership of the passed medium

It will be available in 26.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2025-12-23 15:21:33 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-26-2":

https://git.libreoffice.org/core/commit/8a3e2956c69670929123f01c6baa0a1f92f2c2d7

tdf#127675: SfxObjectShell::DoLoad takes ownership of the passed medium

It will be available in 26.2.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 devseppala 2026-01-20 15:14:08 UTC
@Mike Kaganski, I tested your fix in Calc 26.2.0.2, but Calc still hangs when trying to save a document that has cells pasted from Excel 2013.

Version: 26.2.0.2 (X86_64)
Build ID: 620(Build:2)
CPU threads: 16; OS: Windows 11 X86_64 (build 26200); UI render: Skia/Vulkan; VCL: win
Locale: fi-FI (fi_FI); UI: en-GB
Calc: CL threaded
Comment 22 devseppala 2026-01-23 16:10:47 UTC
(In reply to Mike Kaganski from comment #17)
> Reproducible; no sample nor new report needed. I will fix the implementation.

Just posting my last message again in hope that it reaches you this time. I tested your fix in Calc 26.2.0.2, but Calc still hangs when trying to save a document that has cells pasted from Excel 2013. Does the fix work for you in the  LO 26.2.0.2 RC2 version?
Comment 23 Mike Kaganski 2026-01-23 17:55:35 UTC
(In reply to devseppala from comment #22)
> Does the fix work for you in the  LO 26.2.0.2 RC2 version?

Yes.
Comment 24 devseppala 2026-01-26 11:57:05 UTC
(In reply to Mike Kaganski from comment #23)
> (In reply to devseppala from comment #22)
> > Does the fix work for you in the  LO 26.2.0.2 RC2 version?
> 
> Yes.

Now I got a chance to test this on a completely different machine with MS Excel 2019. I installed LO 26.2.0.2 and tried copy pasting some cells from Excel 2019 to Calc. Pasting worked fine, but saving the document failed as before, Calc becomes completely unresponsive when trying to save the file.


Version: 26.2.0.2 (X86_64)
Build ID: 620(Build:2)
CPU threads: 8; OS: Windows 11 X86_64 (build 26200); UI render: Skia/Raster; VCL: win
Locale: fi-FI (fi_FI); UI: en-GB
Calc: threaded
Comment 25 devseppala 2026-02-01 18:12:27 UTC
Just installed LO 26.2.0.3 and tried again copy pasting cells from Excel 2013. The same issue persist, Calc hangs and becomes unresponsive when saving.

Version: 26.2.0.3 (X86_64)
Build ID: 620(Build:3)
CPU threads: 16; OS: Windows 11 X86_64 (build 26200); UI render: Skia/Vulkan; VCL: win
Locale: fi-FI (fi_FI); UI: en-GB
Calc: CL threaded
Comment 26 Mike Kaganski 2026-02-02 04:23:29 UTC
Created attachment 205306 [details]
Screencast

Here is a screencast showing that it works, no hang. You need to provide more details, what specifically and how exactly you do. And likely, you need to create a new bug report.
Comment 27 devseppala 2026-02-02 09:28:03 UTC
(In reply to Mike Kaganski from comment #26)
> Here is a screencast showing that it works, no hang. You need to provide
> more details, what specifically and how exactly you do. And likely, you need
> to create a new bug report.

Thank you very much for the screencast! By following your steps exactly, I was able to copy paste cells from Excel to Calc and save the document succesfully.

What you are doing different to me, is that you  are copy pasting over 65536 rows. For some reason it hangs for me if I copy paste only a few cells (first copy paste!). Can you test this too. Also, after copy pasting over 65536 rows of cells, I can copy paste smaller cell ranges after that and it does not hang while saving. It seems to only hang if the first paste is within a BIFF8 range.
Comment 28 Mike Kaganski 2026-02-02 09:44:42 UTC
Created attachment 205313 [details]
Screencast with five cells

This is another screencast.

1. Without some *very precise* steps, we will keep guessing. Please unde3rstand, that *no matter if you believe anything will fails as you describe*, it doesn't take much from you to provide some specific steps that you see fail, one sequence from multiple you tried; but it takes insane amount of effort from others to guess some small detail that is obvious to you.

2. Please file a new bug for this new issue. It *is* different (even if related).
Comment 29 devseppala 2026-02-02 12:04:48 UTC
Created attachment 205314 [details]
Video showing exact steps for getting Calc hang after copy paste from Excel

(In reply to Mike Kaganski from comment #28)
> 1. Without some *very precise* steps, we will keep guessing. 
> 2. Please file a new bug for this new issue. It *is* different (even if
> related).

Thanks Mike for still hanging here with me, pun intended.

It is amazing how you can find ever so slightly different ways for copy pasting cell from Excel to Calc than what I do, and not hang calc :)

But, now I think I got it. If you copy paste cells to the first row (or starting from the first row), calc does not hang. 

I also made a screencast for you that shows the exact steps needed. Follow the same cell ranges while copying and while pasting to. With these instructions I am certain you that you can replicate the bug.

You are also likely right that this is not related to this issue and I need to do a new bug report. I did some more tests and found out that this was likely introduced in 26.2.0.0.beta1 or alpha versions. I the beta1 and it has similar issue, but there LO actually crashes and not just hangs.

Can you advice me how to file a bug against an unreleased LO (26.2.0.0.beta1) version.

Thanks again Mike for working with me on this.
Comment 30 Buovjaga 2026-02-02 12:34:07 UTC
(In reply to devseppala from comment #29)
> Can you advice me how to file a bug against an unreleased LO
> (26.2.0.0.beta1) version.

I created that version now in Bugzilla. But don't let the lack of an exact version stop you in the future, you can use unspecified as well.
Comment 31 Mike Kaganski 2026-02-02 12:44:55 UTC
(In reply to devseppala from comment #29)

Thanks! I will try to reproduce as soon as I am at my keyboard.

> Can you advice me how to file a bug against an unreleased LO
> (26.2.0.0.beta1) version.

Please don't think about correct version in the bug. Just create it with any version (unknown is also OK), and copy the text from Help->About. Don't forget to CC me.
Comment 32 devseppala 2026-02-02 13:51:51 UTC
(In reply to Mike Kaganski from comment #31)
> forget to CC me.

Now I created Bug 170567 and added you to the CC-list.