如何使用PHP增加Excel单元格可以容纳的数据量 [英] How to Increase amount of data an Excel cell can hold using PHP

查看:79
本文介绍了如何使用PHP增加Excel单元格可以容纳的数据量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对在应用程序中将数据库记录导出到excel文件有要求. 为此,我使用博客指向Blog的外部链接

I have a requirement on exporting Database records to excel file in my application. For this purpose i am using a light weight class from a blog External Link to Blog

它可以正常工作..但是我遇到了一个问题..如果String长度大于200,则表明它没有在单元格中插入数据.我想增加一个单元格可以容纳的数据量.有人吗?如何使用PHP正常完成操作

It works fine.. But I am facing a problem.. If String length is more than Say 200, then it is not inserting data to the cell. I want to increase amount of data a cell can hold.. Does anybody have any idea, how it can be done normally using PHP

谢谢您的帮助

推荐答案

Excel对单元格可以容纳的数据量有限制:对于Excel BIFF 8文件,该限制为32,767个字符,因此(理论上)为200个以上字符应该不是问题. 但是,对于较长的字符串,此数据将在具有连续记录的多个块中保存在BIFF文件中.对于BIFF 5文件(Excel 95),限制为每个块2084个字节;在BIFF 8文件(Excel 97及更高版本)中,限制为8228字节.长度超过这些限制的记录必须分成CONTINUE块.

Excel has limits on the amount of data a cell can hold: for Excel BIFF 8 files, that limit is 32,767 characters, so (in theory) 200+ characters should not be an issue. However, for longer strings, this data is maintained in the BIFF file across several blocks with continuation records, For BIFF 5 files (Excel 95) the limit is 2084 bytes per block; in BIFF 8 files (Excel 97 and above) the limit is 8228 bytes. Records that are longer than these limits must be split up into CONTINUE blocks.

这个相对简单的编写器并没有编写处理将记录拆分为多个连续记录的方法:它甚至不使用BIFF 8共享字符串表,也没有指出它正在编写的BIFF版本(这意味着Excel将使用以下命令打开它)最低公分母参数).它只是尝试将单元格的全部内容存储到标准标签块(限制为255个字节)中.要解决此问题,您需要修复用于处理使用连续块(通过共享字符串表)分割字符串值的库;或切换到可以处理将共享字符串拆分成多个块的库.

This relatively simplistic writer isn't written to handle splitting the record into multiple continuation records: it doesn't even use the BIFF 8 shared string table, or indicate what BIFF version it is writing (which means Excel will open it using lowest common denominator parameters). It simply tries to store the entire contents of the cell into a standard label block (which has a limit of 255 bytes). To fix this, you'd need to fix the library that you're using to handle splitting the string values with continuation blocks (via a shared string table); or switch to a library that does handle splitting the shared strings across multiple blocks already.

这篇关于如何使用PHP增加Excel单元格可以容纳的数据量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆