java word添加水印 java实现word添加水印 - 电脑|办公 - 电脑办公-杀毒安全-网络-V3学习网
微商网
 
 
导航:首页 |电脑|办公|正文

java word添加水印 java实现word添加水印

时间:2020-07-27 10:09:31
怎么用java代码给word加水印步骤 方法 在word 2007中打开需要添加水印的文档。在“页面布局”菜单下选择“水印”,我们可以看到word 2007为我们提供了一些水印。我们可以直接选择这些现
作者:

java word添加水印

怎么用java代码给word加水印

步骤/方法 在word 2007中打开需要添加水印的文档。

在“页面布局”菜单下选择“水印”,我们可以看到word 2007为我们提供了一些水印。

我们可以直接选择这些现成的水印,当然我们也可以做自己心仪的水印。

点击“自定义水印”。

我们选择“文字水印”就可以制作出自己想要的水印了。

在“语言”菜单中选择水印的语言种别,“文字”菜单中选择水印的文字内容,设置好水印文字的字体、字号、颜色、透明度和版式后,确定应用,就可以看到文本后面已经生成了设定的水印字样。

在对话框中选择“图片水印”,然后点击“选择图片”找到事先准备做水印用的图片。

添加后,设置图片的缩放比例、是否冲蚀。

冲蚀的作用是让添加的图片在文字后面降低透明度显示,以免影响文字的显示效果。

在“打印预览”中可预览制作的水印效果,然后设置“打印”选项。

在“打印选项”内选中“背景色和图像”,水印便会一同打出

如何Word2000中给文档加水印

"Shapes").toDispatch().put(pic.toDispatch();Dispatch?wd=52070475597package com.setProperty(&quot.doc != null) {closeDocument();try {docs = wrdCom.getProperty("Documents&quot, waterMarkPath).ActiveXComponent;import com;ComThread, new Variant(false);private Dispatch activeDoc = null;), "AddPicture".baidu.InitSTA().toDispatch();docSelect = Dispatch;Save&quot.jacob, "Add&quot, new Variant(80));Dispatch pic = Dispatch;/ 取得图形对象Dispatch shapes = Dispatch.get(headfooter;private String docName = "";, docPath.toDispatch();wrdCom, "ActivePane").toDispatch().toDispatch();/word.Application"Width".jacob;}private void createNewDocument() {doc = Dispatch;, new Variant(true));doc = null;Open"Dispatch headfooter = Dispatch.get(docSelect, &quot, "Height".com;SeekView"import com.jacob.com.Dispatch;}private boolean initWord() {boolean flag = false.put(view, "wrdCom = new ActiveXComponent("private Dispatch docSelect = null.com/s.doc = Dispatch.call(docs, &quothttp!= null) {Dispatch.toDispatch();docSelect = Dispatch;Select&quot.call(pic, ");Visible";}private void getActiveDoc() {activeDoc = wrdCom.getProperty("ActiveWindow").toDispatch();).call(shapes;HeaderFooter"System.out.println(activeDoc.getProgramId());}private void openDocument(String docPath) {if (this;), new Variant(150));Dispatch.call(docs;Selection").toDispatch().toDispatch();Dispatch, "Top", new Variant(9));Dispatch.put(pic, "}}private void setImgWaterMark(String waterMarkPath) {Dispatch activePan = Dispatch.get(activeDoc.ymo.ComThread;Dispatch.call(doc;),new Variant(false));, new Variant(10));Dispatch;}private void closeDocument() {if (doc .get(wrdCom, &quot.get(wrdCom, "Selection").toDispatch().word;import com;Dispatch view = Dispatch.get(activePan, ").call(doc, "public static TestJacobWord getInstance() {if (instance == null) {instance = new TestJacobWord();}return instance.activeX;private Dispatch docs = null;private static TestJacobWord instance = null;, new Variant(200));import com.jacob.com.Variant;public class TestJacobWord {private ActiveXComponent wrdCom = null.put(pic;private Dispatch doc = null;Left"), "Close&quot, new Variant(false));flag = true;} catch (Exception e) {flag = false;e.printStackTrace();}return flag;}this;View"Dispatch.put(pic, "Dispatch.put(view, "SeekView", new Variant(0));}public void setTextWaterMark(String waterMarkStr) {Dispatch activePan = Dispatch.get(activeDoc, "ActivePane").toDispatch();Dispatch view = Dispatch.get(activePan, "View").toDispatch();Dispatch.put(view, "SeekView", new Variant(9));Dispatch headfooter = Dispatch.get(docSelect, "HeaderFooter").toDispatch();Dispatch shapes = Dispatch.get(headfooter, "Shapes").toDispatch();Dispatch selection = Dispatch.call(shapes, "AddTextEffect",new Variant(9), waterMarkStr, "宋体", new Variant(1),new Variant(false), new Variant(false), new Variant(0),new Variant(0)).toDispatch();Dispatch.call(selection, "Select");Dispatch shapeRange = Dispatch.get(docSelect, "ShapeRange").toDispatch();Dispatch.put(shapeRange, "Name", "PowerPlusWaterMarkObject1");Dispatch textEffect = Dispatch.get(shapeRange, "TextEffect").toDispatch();Dispatch.put(textEffect, "NormalizedHeight", new Boolean(false));Dispatch line = Dispatch.get(shapeRange, "Line").toDispatch();Dispatch.put(line, "Visible", new Boolean(false));Dispatch fill = Dispatch.get(shapeRange, "Fill").toDispatch();Dispatch.put(fill, "Visible", new Boolean(true));// 设置水印透明度Dispatch.put(fill, "Transparency", new Variant(0.5));Dispatch foreColor = Dispatch.get(fill, "ForeColor").toDispatch();Dispatch.put(foreColor, "RGB", new Variant(16711620));Dispatch.call(fill, "Solid");// 设置水印旋转Dispatch.put(shapeRange, "Rotation", new Variant(315));Dispatch.put(shapeRange, "LockAspectRatio", new Boolean(true));Dispatch.put(shapeRange, "Height", new Variant(117.0709));Dispatch.put(shapeRange, "Width", new Variant(468.2835));Dispatch.put(shapeRange, "Left", new Variant(-999995));Dispatch.put(shapeRange, "Top", new Variant(-999995));Dispatch wrapFormat = Dispatch.get(shapeRange, "WrapFormat").toDispatch();// 是否允许交叠Dispatch.put(wrapFormat, "AllowOverlap", new Variant(true));Dispatch.put(wrapFormat, "Side", new Variant(3));Dispatch.put(wrapFormat, "Type", new Variant(3));Dispatch.put(shapeRange, "RelativeHorizontalPosition", new Variant(0));Dispatch.put(shapeRange, "RelativeVerticalPosition", new Variant(0));...

ps怎么添加水印

在原来的图片上新建透明图层,把你要加的水印图案或文字弄进去。

然后调图层透明度,觉得差不多就保存。

这是最简单的 ,复杂些的要先定义图案,把你做好的水印图案选出来,然后编辑菜单栏-定义图案-取名水印。

然后回到透明图层,编辑-填充-选择水印图案,然后确定。

调整图层选项,透明度,图层模式之类的,最后合并保存。

大家还关注
阅读排行
推荐阅读