计算Word文档中的页数-未安装Office的服务器 [英] Counting number of pages in word document - Server not having office installed

查看:85
本文介绍了计算Word文档中的页数-未安装Office的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我正在寻找一种解决方案,在没有安装Office的服务器上并且无法使用Word应用程序对象的情况下,对Word文档中的页数进行计数.

在我的网站上,用户将任何DOc,DOcx文件加载到服务器,而我想知道该文件包含多少页.

我知道有很多奖励解决方案,但正在寻找免费的解决方案.

Tx,

dav



I''m looking for a solution of counting number of pages in a word document while the server not having Office installed and therfore I cannot use an word application object.

In my website the user load any DOc,DOcx file to the server and I want to kno how many pages the file contain.

I know there are meny reward solution but searching for free ones.

Tx,

dav

推荐答案

这不是正确提出的问题.您可以计算单词数或其他内容,但不能计算页面数.

问题是:页数不是文档的属性.根据您在其中查看文档的窗口的宽度或其打印预览(结果的页数可能会有所不同!),打印参数以及其他因素(例如所用的软件),文档将被格式化为不同的页数.用于查看或打印.这样,可以保留文档的结构和完整性,但不能保留页数.

这样,问题就没有定义,您不应该尝试解决它,因为这没有任何意义.只需使用其他一些衡量文档大小的方法即可.我只是建议它的字节大小.

—SA
This is not correctly posed problem. You can count number of words or something, but not number of pages.

The thing is: a number of pages is not an attribute of a document. The document will be formatted to different number of pages depending on the width of the window where you view the document or its print preview (results can be different in number of pages!), or printing parameters and perhaps other factors, such as software used for viewing or printing. In this way, the structure and integrity of document is preserved, but not number of pages.

In this way, the problem is not defined and you should not try to solve it as it makes no sense. Just use some other measure of the size of the document. I would simply suggest a byte size of it.

—SA


您可能需要使用第三方库,例如 http: //www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-print-multiple-pages-on-one-sheet.html [
You may have to work with third party libraries like Aspose.Words[^]. Here is how you can count number of page over the web. http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-print-multiple-pages-on-one-sheet.html[^]


我想过要解决,但需要您的帮助.

我有一个使用正则表达式计算PDF文件中页面数的代码.

如果我能够(再次使用免费工具)将服务器上的文件转换为PDF,那么我将能够在该PDf文件上运行代码.

我搜索了新内容并找到了一些解决方案:
1.将文件发送到网站并通过邮件取回文件-很长的时间我无法等待接收邮件.
2.使用"itextsharp-all-5.1.2"创建PDF-不支持将Doc转换为PDF.
3.使用驱动程序-非常昂贵,满足我的需求.

我将很高兴收到任何廉价建议的建议.我不在乎转换为PDf文件是否会将广告添加到文档中,因为我不需要PDF,我只想生成它,这样我就可以计算页面数.
I thought on a work around but need your assitance.

I have a code that using regular expressions to count the number of pages in a PDF file.

If I will be able to convert (again with free tool) on the server the file to PDF then I will be able to run the code on that PDf file.

I search the new and found some solution:
1. send the file to website and get the file back by mail - long time that I cannot wait for reciving mail.
2. create PDF using "itextsharp-all-5.1.2" - not supporting converting Doc to PDF.
3. Use drivers - very expensive for my needs.

I will be glad to get any suggestion for a cheap way to do that. I don''t care if the convert to PDf file will add commercials to the doc, because I don''t need that PDF I just want to produce it so I will be able count the pages.


这篇关于计算Word文档中的页数-未安装Office的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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