有没有办法在
PHP中访问压缩RTF和输出RTF代码到浏览器?
我在sql中有一个文本列,我想从中提取RTF – 我已经设法将数据输出为0x1F8B
我相信这个数据是压缩RTF – http://www.freeutils.net/source/jtnef/rtfcompressed.jsp
使用[MS-OXRTFCP]:RTF压缩算法http://msdn.microsoft.com/en-us/library/cc463890%28v=exchg.80%29
样品数据:
0x1F8B0800000000000000654E316EC3300CEC5CA07FE0D6AD909D1628E0A1C8D01F74E422CB94CD46A11C4A6E5018F97B6967EC72381EC9BB5B516B6CD04BE11DC23C36ED5B8B03C5E8364C5EC6C61D0E2BC62CB5F6C988C358AE5C0AC6592F2DC630792D541D1C957DEA6E76D260144EFF57B7A7C715434E59CD0A3A541A1C8E4A240EFBB490EBEC027F98AE2796E11597D0E0EC75C013D1BC8360F1EF0EC316B115695BF89A08CE390B70816ABC571EA74AA542EEBF295460D975642B069F5EEBF45C6CB27707E5F4FBB14558EC1D83D9EEEC28D9BE142E8B59719697BB6C051FFE00D09796A337010000
这看起来像我想要的,但它在VB http://www.vbforums.com/attachment.php?attachmentid=87371&d=1326754610
您的数据样本是gzip数据,使用
原文链接:https://www.f2er.com/php/132293.htmlgzdecode
进行解码.您需要传递一个二进制字符串而不是提供的十六进制字符串(使用
hex2bin
或
pack
进行转换)
if (!function_exists(hex2bin)){ function hex2bin($hexStr){ return pack('H*',$hexStr); } } $rtf = gzdecode(hex2bin('1F8B00000000000654E316EC3300CEC5CA07FE0D6AD909D1628E0A1C8D01F74E422CB94CD46A11C4A6E5018F97B6967EC72381EC9BB5B516B6CD04BE11DC23C36ED5B8B03C5E8364C5EC6C61D0E2BC62CB5F6C988C358AE5C0AC6592F2DC630792D541D1C957DEA6E76D260144EFF57B7A7C715434E59CD0A3A541A1C8E4A240EFBB490EBEC027F98AE2796E11597D0E0EC75C013D1BC8360F1EF0EC316B115695BF89A08CE390B70816ABC571EA74AA542EEBF295460D975642B069F5EEBF45C6CB27707E5F4FBB14558EC1D83D9EEEC28D9BE142E8B59719697BB6C051FFE00D09796A337010000'));The moon is the brightest object in the Earth's sky?
Another question.
这是原始数据.
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fnil\fcharset0 Arial;}} {\colortbl ;\red0\green0\blue0;} \viewkind4\uc1\pard\keep\keepn\sa80\cf1\f0\fs22 The moon is the brightest object in the \i\f1 Earth's \i0\f0 sky?\par \par \cf0\par Another question.\par }
这是渲染文本.
The moon is the brightest object in the Earth’s sky?
Another question.
我不知道如果你只想要原始的rtf或渲染,看看Free (preferably) PHP RTF to HTML converter?如果你想要rtf在html.