文件管理 · 2022年9月11日

php预览word|朋友你好

❶ php在线预览word,txt,xls文件,怎么做

思路这种类似网络文库的flash预览文档的东东,其主要思路如下:将word/excel/ppt格式专的文档属,即office支持的主要文档格式通过OpenOffice转成pdf的插件,将文档先转成pdf格式。通过swftools(http://www.swftools.org/)这个软件将pdf转成flash格式。最后flash的显示,可以使用flexpaper,亦可以自己写一个显示flash格式的东东,然后成功显示多种格式的文档,即类似网络文库的实现。pdf的预览是将pdf的每一页转为图片,对应的放大、缩小均是对图片直接进行操作,此时放大、缩小会有失真的情况出现。其他例如work/excel/ppt等文档,均是转为了html页面,是的在线预览时可以选中文字,图片等。具体 很麻烦 需要 详细 请 私信!

❷ PHP实现word以及其他常见格式文档在线预览

不用插件你就开玩笑了,这个不是简单的程序问题,还要破解文件格式,插件就只需要一个东西,openoffice,非常好用

❸ 朋友你好,请问你用PHP如何实现在线预览PDF/WORD文档的,能传代码给我吗非常感谢

php自带pdf函数,你可以直接使用,具体看php手册,我大概给你列一些PDF_activate_item — Activate structure element or other content itemPDF_add_annotation — Add annotation [deprecated]PDF_add_bookmark — Add bookmark for current page [deprecated]PDF_add_launchlink — Add launch annotation for current page [deprecated]PDF_add_locallink — Add link annotation for current page [deprecated]PDF_add_nameddest — Create named destinationPDF_add_note — Set annotation for current page [deprecated]PDF_add_outline — Add bookmark for current page [deprecated]PDF_add_pdflink — Add file link annotation for current page [deprecated]PDF_add_table_cell — Add a cell to a new or existing tablePDF_add_textflow — Create Textflow or add text to existing TextflowPDF_add_thumbnail — Add thumbnail for current pagePDF_add_weblink — Add weblink for current page [deprecated]PDF_arc — Draw a counterclockwise circular arc segmentPDF_arcn — Draw a clockwise circular arc segmentPDF_attach_file — Add file attachment for current page [deprecated]PDF_begin_document — Create new PDF filePDF_begin_font — Start a Type 3 font definitionPDF_begin_glyph — Start glyph definition for Type 3 fontPDF_begin_item — Open structure element or other content itemPDF_begin_layer — Start layerPDF_begin_page_ext — Start new pagePDF_begin_page — Start new page [deprecated]PDF_begin_pattern — Start pattern definitionPDF_begin_template_ext — Start template definitionPDF_begin_template — Start template definition [deprecated]PDF_circle — Draw a circlePDF_clip — Clip to current pathPDF_close_image — Close imagePDF_close_pdi_page — Close the page handlePDF_close_pdi — Close the input PDF document [deprecated]PDF_close — Close pdf resource [deprecated]PDF_closepath_fill_stroke — Close, fill and stroke current pathPDF_closepath_stroke — Close and stroke pathPDF_closepath — Close current pathPDF_concat — Concatenate a matrix to the CTMPDF_continue_text — Output text in next linePDF_create_3dview — Create 3D viewPDF_create_action — Create action for objects or eventsPDF_create_annotation — Create rectangular annotationPDF_create_bookmark — Create bookmarkPDF_create_field — Create form fieldPDF_create_fieldgroup — Create form field groupPDF_create_gstate — Create graphics state objectPDF_create_pvf — Create PDFlib virtual filePDF_create_textflow — Create textflow objectPDF_curveto — Draw Bezier curvePDF_define_layer — Create layer definitionPDF_delete_pvf — Delete PDFlib virtual filePDF_delete_table — Delete table objectPDF_delete_textflow — Delete textflow objectPDF_delete — Delete PDFlib objectPDF_encoding_set_char — Add glyph name and/or Unicode valuePDF_end_document — Close PDF filePDF_end_font — Terminate Type 3 font definitionPDF_end_glyph — Terminate glyph definition for Type 3 fontPDF_end_item — Close structure element or other content itemPDF_end_layer — Deactivate all active layersPDF_end_page_ext — Finish pagePDF_end_page — Finish pagePDF_end_pattern — Finish patternPDF_end_template — Finish templatePDF_endpath — End current pathPDF_fill_imageblock — Fill image block with variable dataPDF_fill_pdfblock — Fill PDF block with variable dataPDF_fill_stroke — Fill and stroke pathPDF_fill_textblock — Fill text block with variable dataPDF_fill — Fill current pathPDF_findfont — Prepare font for later use [deprecated]PDF_fit_image — Place image or templatePDF_fit_pdi_page — Place imported PDF pagePDF_fit_table — Place table on pagePDF_fit_textflow — Format textflow in rectangular areaPDF_fit_textline — Place single line of textPDF_get_apiname — Get name of unsuccessfull API functionPDF_get_buffer — Get PDF output bufferPDF_get_errmsg — Get error textPDF_get_errnum — Get error numberPDF_get_font — Get font [deprecated]PDF_get_fontname — Get font name [deprecated]PDF_get_fontsize — Font handling [deprecated]PDF_get_image_height — Get image height [deprecated]PDF_get_image_width — Get image width [deprecated]PDF_get_majorversion — Get major version number [deprecated]PDF_get_minorversion — Get minor version number [deprecated]PDF_get_parameter — Get string parameterPDF_get_pdi_parameter — Get PDI string parameter [deprecated]PDF_get_pdi_value — Get PDI numerical parameter [deprecated]PDF_get_value — Get numerical parameterPDF_info_font — Query detailed information about a loaded fontPDF_info_matchbox — Query matchbox informationPDF_info_table — Retrieve table informationPDF_info_textflow — Query textflow statePDF_info_textline — Perform textline formatting and query metricsPDF_initgraphics — Reset graphic statePDF_lineto — Draw a linePDF_load_3ddata — Load 3D modelPDF_load_font — Search and prepare fontPDF_load_iccprofile — Search and prepare ICC profilePDF_load_image — Open image filePDF_makespotcolor — Make spot colorPDF_moveto — Set current pointPDF_new — Create PDFlib objectPDF_open_ccitt — Open raw CCITT image [deprecated]PDF_open_file — Create PDF file [deprecated]PDF_open_gif — Open GIF image [deprecated]PDF_open_image_file — Read image from file [deprecated]PDF_open_image — Use image data [deprecated]PDF_open_jpeg — Open JPEG image [deprecated]PDF_open_memory_image — Open image created with PHP's image functions [not supported]PDF_open_pdi_page — Prepare a pagePDF_open_pdi — Open PDF file [deprecated]PDF_open_tiff — Open TIFF image [deprecated]PDF_pcos_get_number — Get value of pCOS path with type number or booleanPDF_pcos_get_stream — Get contents of pCOS path with type stream, fstream, or stringPDF_pcos_get_string — Get value of pCOS path with type name, string, or booleanPDF_place_image — Place image on the page [deprecated]PDF_place_pdi_page — Place PDF page [deprecated]PDF_process_pdi — Process imported PDF documentPDF_rect — Draw rectanglePDF_restore — Restore graphics statePDF_resume_page — Resume pagePDF_rotate — Rotate coordinate systemPDF_save — Save graphics statePDF_scale — Scale coordinate systemPDF_set_border_color — Set border color of annotations [deprecated]PDF_set_border_dash — Set border dash style of annotations [deprecated]PDF_set_border_style — Set border style of annotations [deprecated]PDF_set_char_spacing — Set character spacing [deprecated]PDF_set_ration — Set ration between pages [deprecated]PDF_set_gstate — Activate graphics state objectPDF_set_horiz_scaling — Set horizontal text scaling [deprecated]PDF_set_info_author — Fill the author document info field [deprecated]PDF_set_info_creator — Fill the creator document info field [deprecated]PDF_set_info_keywords — Fill the keywords document info field [deprecated]PDF_set_info_subject — Fill the subject document info field [deprecated]PDF_set_info_title — Fill the title document info field [deprecated]PDF_set_info — Fill document info fieldPDF_set_layer_dependency — Define relationships among layersPDF_set_leading — Set distance between text lines [deprecated]PDF_set_parameter — Set string parameterPDF_set_text_matrix — Set text matrix [deprecated]PDF_set_text_pos — Set text positionPDF_set_text_rendering — Determine text rendering [deprecated]PDF_set_text_rise — Set text rise [deprecated]PDF_set_value — Set numerical parameterPDF_set_word_spacing — Set spacing between words [deprecated]PDF_setcolor — Set fill and stroke colorPDF_setdash — Set simple dash patternPDF_setdashpattern — Set dash patternPDF_setflat — Set flatnessPDF_setfont — Set fontPDF_setgray_fill — Set fill color to gray [deprecated]PDF_setgray_stroke — Set stroke color to gray [deprecated]PDF_setgray — Set color to gray [deprecated]PDF_setlinecap — Set linecap parameterPDF_setlinejoin — Set linejoin parameterPDF_setlinewidth — Set line widthPDF_setmatrix — Set current transformation matrixPDF_setmiterlimit — Set miter limitPDF_setpolydash — Set complicated dash pattern [deprecated]PDF_setrgbcolor_fill — Set fill rgb color values [deprecated]PDF_setrgbcolor_stroke — Set stroke rgb color values [deprecated]PDF_setrgbcolor — Set fill and stroke rgb color values [deprecated]PDF_shading_pattern — Define shading patternPDF_shading — Define blendPDF_shfill — Fill area with shadingPDF_show_boxed — Output text in a box [deprecated]PDF_show_xy — Output text at given positionPDF_show — Output text at current positionPDF_skew — Skew the coordinate systemPDF_stringwidth — Return width of textPDF_stroke — Stroke pathPDF_suspend_page — Suspend pagePDF_translate — Set origin of coordinate systemPDF_utf16_to_utf8 — Convert string from UTF-16 to UTF-8PDF_utf32_to_utf16 — Convert string from UTF-32 to UTF-16PDF_utf8_to_utf16 — Convert string from UTF-8 to UTF-16

❹ 求救,php实现word等文档的web端文件预览,类似于百度文库

貌似php不擅长这个,只能提供思路给你。事实上word文档是无法在非IE(就算是IE还要已内经装了office才行)上预览的,通过容网络文库看到的也一样,真实的过程是文件在上传后已经通过特定的类库解析成xml格式,然后存储,然后预览的时候是将这些数据配合样式模拟成word文档的样子而已。估计PHP用于解析word文档的类库不好找,你可以通过.net辅助一下。浏览器上传 -> PHP读取上传文件内容 -> PHP发送文件信息给.net程序 ->PHP获取.net程序返回的xml 并处理保存当用户要看的时候php读出xml,然后配合适当的css展示。

❺ php 如何实现在线预览文件如:txt,doc,pdf等

第一种 预览$file = fopen($path,"r"); // 打开文件// 输入文件标签Header("Content-type: application/pdf");// Header("filename:" . $file_name);// 输出文件内容echo fread($file,filesize($path));fclose($file);第二种下载Header("Content-type: application/pdf");// 文件将被称为 downloaded.pdfheader("Content-Disposition:attachment;filename='downloaded.pdf'");readfile($path);第三种预览Header("Content-type: application/pdf");// 文件将被称为 downloaded.pdfheader("Content-Disposition:inline;filename='downloaded.pdf'");readfile($path);第四种下载$file = fopen($path,"r"); // 打开文件// 输入文件标签Header("Content-type: application/octet-stream");Header("Accept-Ranges: bytes");Header("Accept-Length: ".filesize($path));Header("Content-Disposition: attachment; filename=" . $file_name);// 输出文件内容echo fread($file,filesize($path));fclose($file);

❻ PHP怎样读取word文档实现在线预览,并且不受操作系统的限制,利用COM组件的话太受限了

你可以尝试一来下PHPWord,用它可以把自任意word文件转换为html网页,这样任何人都可以在浏览器里查看你的word文件了。PHPWord尽管目前只是测试版但是功能还是很强劲!完美兼容MF Word并且支持打开.doc or.docx。可以插入文本,文本符,分页,页眉/页脚,表格,列表中的元素,超链接等等。地址:http://phpword.codeplex.com

❼ 如何使用PHP显示在线Word文档

php 在线预览 word 文档,有多种方法,本质上来说,大多是调用客户端电脑系统安装的 Word 软件。可以用 php 语言的 com 支持功能函数来完成,比如:$word = new COM("word.application") or die("Unable to instanciate Word");$word->Documents->Open($url.$wordname);或者使用 word 文档的插件来完成,比如:swftools 等。

❽ 如何使用PHP显示word文档在网页h1

html中标题的一些知识,在html中标题用h1到h6来表示与强调,这里所谓的标题,英文单词是heading,不是title。有需要的朋友参考下。本节内容:html标题标签html标题标签(h1~h6)标题标签(<h1>~<h6>)的定义这里所谓的标题,英文单词是heading,不是title。在html中,出现在windows标题栏的标题是title,但在正文中的标题,我们是指的heading。使用的标签是<h1>到<h6>。这里要注意的是<h1>的字体最大,<h6>字最小。跟<font>标签的size属性是反的,size值为1最小,值为7最大。例子:复制代码 代码示例:<h1>最大的1号标题字</h1><h2>2号标题字</h2><h3>3号标题字</h3><h4>4号标题字</h4><h5>5号标题字</h5><h6>最小的6号标题字</h6>注意事项1、独占一行因为是标题字,所以它们都必须是独占一行的!也就是说它的前后都不可能有其它内容。2、标题标签只用于标题使用<h1>到<h6>标签,会让文字变大变粗。但千万不要因为想让文字变大变粗就给他加一个标题标签,这是错误!你可以使用<font>或<b>标签来实现。3、标题标签对于搜索引擎的影响搜索引擎会把文章中出现的<h1>到<h6>标签来作为文章的结构与主次,从而进行索引。懂seo的朋友就知道,这个很重要!

❾ php 怎么实现在线预览 word 文档

目前程序编译语言有很多种,其中php是最为常见的一种编程语言。php读取word文档是很多朋友都想了解的,下面就由达内的老师为大家介绍一下。?php/**必须将php.ini中的com.allow_dcom设为true*/functionphp_word($wordname,$htmlname,$content){//获取链接地址$url=$_server['http_host'];$url=";$url=$url.$_server['php_self'];$url=dirname($url)."/";//建立一个指向新com组件的索引$word=newcom("word.application")ordie("unabletoinstanciateword");//显示目前正在使用的word的版本号echo"loadingword,v.{$word-version}";//把它的可见性设置为0(假),如果要使它在最前端打开,使用1(真)$word->visible=1;//———————————读取word内容操作start—————————————–//打开一个word文档$word->documents->open($url.$wordname);//将filename.doc转换为html格式,并保存为html文件$word->documents[1]->saveas(dirname(__file__)."/".$htmlname,8);//获取htm文件内容并输出到页面(文本的样式不会丢失)$content=file_get_contents($url.$htmlname);echo$content;//获取word文档内容并输出到页面(文本的原样式已丢失)$content=$word->activedocument->content->text;echo$content;//关闭与com组件之间的连接$word->documents->close(true);$word->quit();$word=null;unset($word);//———————————新建立word文档操作start————————————–//建立一个空的word文档$word->documents->add();//写入内容到新建word$word->selection->typetext("$content");//保存新建的word文档$word->documents[1]->saveas(dirname(__file__)."/".$wordname);//关闭与com组件之间的连接$word->quit();}php_word("tesw.doc","filename.html","写入word的内容");?>

❿ php实现word文档在线浏览功能

推荐用PageOffice,支持跨浏览器,从PageOffice官方网站的下载中心里下载PageOffice 专业版2 for PHP,有丰富的示例源代码,实现在线编辑保存word。