word

JAVA获取word表格中数据的方案

血红的双手。 提交于 2019-11-27 00:46:52
上一个项目的开发中需要实现从word中读取表格数据的功能,在JAVA社区搜索了很多资料,终于找到了两个相对最佳的方案,因为也得到了不少网友们的帮助,所以不敢独自享用,在此做一个分享。 两个方案分别是:一,用POI的TableIterator获取表格中的数据;二,用PageOffice来获取。   为什么说是两个相对最佳的方案呢?因为两个方案都各有优缺点,POI的优点很明显,就是免费,这正是PageOffice的缺点,PageOffice是一个国产的商业Office组件;POI的缺点有点多,接口复杂调用起来比较麻烦,尤其是不好读取word指定位置处的内容。由于获取表格数据的代码是在服务器端执行的,所以要求很高的代码质量,要考虑到代码执行效率问题、用户请求并发问题、大文档执行慢阻塞页面的问题等等,POI的架构属于仿VBA接口的模型,比VBA代码还要复杂,在调用方便上未做任何优化,光看代码都觉得头疼。所以在实际使用的过程中会遇到这些问题需要自己解决,相对来说这正是PageOffice的优点,使用PageOffice的话,就不会遇到这些问题,因为PageOffice的获取word中表格数据的工作是在客户端执行的,确实也符合了分布式计算思想,减轻服务器端压力,还有个强悍的功能,PageOffice可以从word表格中用很简单一句代码把图片提取出来!!!   PageOffice虽是收费的

Regular expression to match a word or its prefix

浪子不回头ぞ 提交于 2019-11-27 00:07:29
问题 I want to match a regular expression on a whole word. In the following example I am trying to match s or season but what I have matches s , e , a , o and n . [s|season] How do I make a regular expression to match a whole word? 回答1: Square brackets are meant for character class, and you're actually trying to match any one of: s , | , s (again), e , a , s (again), o and n . Use parentheses instead for grouping: (s|season) or non-capturing group: (?:s|season) Note: Non-capture groups tell the

Javascript: Move caret to last character

感情迁移 提交于 2019-11-26 22:19:27
I have a textarea and when I click in it I want to move the caret to the last character so Something[caret] function moveCaret(){ // Move caret to the last character } <textarea onclick="moveCaret();"> Something </textarea> As I know this is somehow possible with the TextRange object, but I don't really know how to use it EDIT: I would love to see only pure javascript solutions so no libraries please. The following function will work in all major browsers, for both textareas and text inputs: function moveCaretToEnd(el) { if (typeof el.selectionStart == "number") { el.selectionStart = el

Getting the word touched in a UILabel/UITextView

坚强是说给别人听的谎言 提交于 2019-11-26 20:50:33
What I'd like to do is to create a text-container component that is able to indicate what is the nearest word when there's is a touch on it (i.e. the word "behind" the touched point). First, I created a UILabel subclass and overrode the touchesEnded:withEvent: method to determine the touched CGPoint. I also wrote a method that compute the corresponding "frame" (CGRect) of each word of the text using sizeWithFont:forWidth:lineBreakMode:. With the touched CGPoint and this frame, I can determine which word is actually being touched. But the method that compute the frame only works with mono-line

Javascript: Words to numbers [closed]

前提是你 提交于 2019-11-26 20:32:13
How can I convert words to numbers in JavaScript? Example: "Nineteen days from now" would become "19 days from now". I'm fine with using jQuery or another library - hopefully a smallish one if it's not jQuery. JavaAndCSharp Here's my JavaScript replacement of @Greg Hewgill's Python module, minus the testing from the bottom of the code: var Small = { 'zero': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9, 'ten': 10, 'eleven': 11, 'twelve': 12, 'thirteen': 13, 'fourteen': 14, 'fifteen': 15, 'sixteen': 16, 'seventeen': 17, 'eighteen': 18,

Word comparison algorithm

北战南征 提交于 2019-11-26 17:38:19
问题 I am doing a CSV Import tool for the project I'm working on. The client needs to be able to enter the data in excel, export them as CSV and upload them to the database. For example I have this CSV record: 1, John Doe, ACME Comapny (the typo is on purpose) Of course, the companies are kept in a separate table and linked with a foreign key, so I need to discover the correct company ID before inserting. I plan to do this by comparing the company names in the database with the company names in

python - find the occurrence of the word in a file

ⅰ亾dé卋堺 提交于 2019-11-26 17:12:37
问题 I am trying to find the count of words that occured in a file. I have a text file ( TEST.txt ) the content of the file is as follows: ashwin programmer india amith programmer india The result I expect is: { 'ashwin':1, 'programmer ':2,'india':2, 'amith ':1} The code I am using is: for line in open(TEST.txt,'r'): word = Counter(line.split()) print word The result I get is: Counter({'ashwin': 1, 'programmer': 1,'india':1}) Counter({'amith': 1, 'programmer': 1,'india':1}) Can any one please help

Extracting whole words

时间秒杀一切 提交于 2019-11-26 16:55:17
问题 I have a large set of real-world text that I need to pull words out of to input into a spell checker. I'd like to extract as many meaningful words as possible without too much noise. I know there's plenty of regex ninjas around here, so hopefully someone can help me out. Currently I'm extracting all alphabetical sequences with '[a-z]+' . This is an okay approximation, but it drags a lot of rubbish out with it. Ideally I would like some regex (doesn't have to be pretty or efficient) that

What are the sizes of tword, oword and yword operands?

二次信任 提交于 2019-11-26 15:52:02
问题 What are the sizes of tword , oword and yword operands, as used in the NASM/YASM manual? And on a related note, is there a trick or underlying idea to these names? Is there a way by which bigger word sizes are given logical names? I know that while word sizes may differ between systems, a NASM word is 2 bytes, dword is double that (4 bytes), qword is a quad word (8 bytes), but... is tword a triple word (6 bytes)? And for oword and yword I can't even think of a plausible meaning. Note that it

java获取word文档的条目化内容

纵饮孤独 提交于 2019-11-26 14:24:56
在开发Web办公系统或文档系统时,PageOffice组件是众所周知的在线处理微软word/ppt/excel文档的强大工具,它对WORD文档的各种处理在API层面进行了封装,屏蔽了Office VBA接口的复杂性,而又不失VBA的强大功能,在此要分享的正是PageOffice封装的一个很强大的功能:获取word文档的条目化内容。在一个包含了文档处理功能的办公系统里,用户出于各种原因,希望能通过程序自动分析word文档中每个章节的内容也是一种合理的需求,而PageOffice为实现此功能提供的接口也非常简单,废话少说,直接看代码:   PageOffice具体的集成过程在此略过。。。(详细看PageOffice for java 开发包中的安装说明)   1. 调用PageOffice在线打开一个包含了章节层次的word文档,比如:test.doc PageOfficeCtrl poCtrl=new PageOfficeCtrl(request); poCtrl.setServerPage(request.getContextPath()+"/poserver.zz"); //打开Word文档 poCtrl.webOpen("doc/test.doc",OpenModeType.docNormalEdit,"张佚名");   2. 在打开word文件的页面(比如:word.jsp