word

Word文档VBA读写Properties文件,让文档动起来

我们两清 提交于 2019-12-02 20:59:01
1、问题背景 由于最近写Word文档比较多,发现文档中很多内容有重复。当然常用手法就是Ctrl+V、Ctrl+C,开始可能还行。但随后客户提出修改要求时就疯了。 Word中为啥没有个变量? 我开始只知道Word有域的概念,但在界面上操作时遇到了困难,很难定义。 2、分析解决 首先有一个域(Field),引起了我的关注 它就是Document Automation下的DocVariable。 如果可以定义这个值和修改(name=value),从某种意义上讲word也可以像程序一样定义变量了。 但问题来了,如果想改变这个值必须通过VBA开发来完成。(-_-写VB吧) 3、VBA程序代码 首先按Alt+F11呼出VBA控制台,选择你Word文档的ThisDocument,粘贴以下代码 '配置文件名默认为 word文件名-docvar.txt '配置文件格式 key=value,#为注释 '解除DovVariable Field,转换为普通文字 Sub unlinkDocVarFields() Dim varResponse As Variant varResponse = MsgBox("是否把文档中的DocumentVariable域替换为普通文字?", vbYesNo) If varResponse = vbYes Then Dim bTrack As Boolean bTrack

How can I use `git diff --color-words` outside a Git repository?

一世执手 提交于 2019-12-02 17:50:36
How can I get output like in git diff --color-words , but outside Git? Closest thing is wdiff -t , but it underlines/inverts things instead of using green/red colours and does not allow specifying my whitespace regex. git diff --color-words --no-index According to a comment from Jefromi you can just use git diff --color-words file1 file2 outside of git repositories too. Git version 1.9.1: git diff --word-diff=color fileA fileB you can say git diff --color=always --color-words , which will give you the color escape codes in the output. you are going to have some shell to interpret the color

Converting number into word

柔情痞子 提交于 2019-12-02 13:45:49
I am a beginner and I have written a program in c++ to convert numbers between 0-99999 into words. It is working fine for numbers upto 100 but after that it gives wrong output. I know there are some serious logical errors but I am just unable to figure these out. //This program converts number into words between 0-99999 #include<iostream> using namespace std; main() { long int number,unit,ten,hundred,thousand,ten_thousand; cout<<"Please enter any number between 0-99999: "; cin>>number; ten_thousand=number/10000; thousand=number/1000; hundred=number/100; ten=number/10; unit=number%10; if(number

php : word proximity script?

独自空忆成欢 提交于 2019-12-02 09:50:25
Okay - so, I've spent ages searching in Google, and even went through a few specific searches at hotscripts etc., several php forums and this place ... nothing (not of use anyway). i want to be able to take a block of text (page/file/doc) and pull it apart to find the "distance" between specific terms (find the proximity/raltional distance etc.). I woudl have thought there'd be at least a few such thigns around - but I'm not finding them. So - it may be harder than I thought. I understand it may be a somewhat "hungry" endevour - as it's likely to be fairly intensive on large documents - but

Javase学习记录之------集合遍历迭代器的使用

↘锁芯ラ 提交于 2019-12-02 00:42:42
Iterator iterator();迭代器,集合的专属遍历方式; 迭代器被定义成一个接口而不是类; 各种集合的遍历方式不同,所以迭代器中的方法在具体的子类中,以内部类的方式体现 Iterator类中的iterator()就是迭代器; 使用方法iterator()要求容器返回一个Iterator。 第一次调用Iterator的next()方法时,它返回序列的第一个元素。注意:iterator()方法是java.lang.Iterable接口,被Collection继承 Object next();获取元素,并移动到下一个位置; next方法,返回的是集合的元素,而集合元素的类型可以是任意类型的,有不确定性,而为了达到代码的通用性,直接指定返回的是Object类型(返回基类) 可以使用泛型明确返回值的类型。 import java . util . ArrayList ; import java . util . Collection ; import java . util . Iterator ; public class CollectionDemo { public static void main ( String [ ] args ) { Collection c = new ArrayList ( ) ; c . add ( "hallo" ) ; c . add (

grep -w with only space as delimiter

给你一囗甜甜゛ 提交于 2019-12-01 21:51:18
grep -w uses punctuations and whitespaces as delimiters. How can I set grep to only use whitespaces as a delimiter for a word? If you want to match just spaces: grep -w foo is the same as grep " foo " . If you also want to match line endings or tabs you can start doing things like: grep '\(^\| \)foo\($\| \)' , but you're probably better off with perl -ne 'print if /\sfoo\s/' You cannot change the way grep -w works. However, you can replace punctuations with, say, X character using tr or sed and then use grep -w , that will do the trick. The --word-regexp flag is useful, but limited. The grep

How do I find words starting with a specific letter?

旧城冷巷雨未停 提交于 2019-12-01 21:49:38
I want to find words which start with a specific letter in a string using the following code. The specific letter would be supplied by the user in a text box. This is what I have: <!DOCTYPE html> <html> <body> <input id="srch" type="text" /> <button onClick=searchword()>Search</button> <p id="wrd" > hallo, this is a test john doe . Another tea house pole. </p> </body> <script> function searchword() { var s = document.getElementById("wrd").innerHTML; var p= document.getElementById("srch").value; var regx = new RegExp("(?:^|\W)" + p + "(\w+)(?!\w)","gi"); var re = regx, match, matches = [];

How do I find words starting with a specific letter?

穿精又带淫゛_ 提交于 2019-12-01 21:18:27
问题 I want to find words which start with a specific letter in a string using the following code. The specific letter would be supplied by the user in a text box. This is what I have: <!DOCTYPE html> <html> <body> <input id="srch" type="text" /> <button onClick=searchword()>Search</button> <p id="wrd" > hallo, this is a test john doe . Another tea house pole. </p> </body> <script> function searchword() { var s = document.getElementById("wrd").innerHTML; var p= document.getElementById("srch")

Match a word using regex that also handles apostrophes

吃可爱长大的小学妹 提交于 2019-12-01 19:35:22
I have to separate a line of text into words, and am confused on what regex to use. I have looked everywhere for a regex that matches a word and found ones similar to this post but want it in java (java doesn't handle \ in regular strings). Regex to match words and those with an apostrophe I have tried the regex for each answer and am unsure of how to structure a regex for java for this (i assumed all regex were the same). If replace \ by \ in the regex i see, the regex doesn't work. I have also tried looking it up myself and have come to this page: http://www.regular-expressions.info

regex php separate an exact word from string in diffrent groups

拥有回忆 提交于 2019-12-01 17:29:34
问题 i have tried all i know but still can't figure out how to resolve this problem : i have a string ex : "--included-- in selling price: 5 % vat usd 10.00 packaging fees 2 % notifying fees" "--not included-- in selling price: us$ 35.00 express fees 2 % notifying fees" i want to know if the taxes are "included" or "excluded" and if the fees are "%" or "currency" the problem is it doesn't detect the currency "usd" while it's attached to the taxe name "vat usd" how can i separate the currency from