当前位置:网站首页>C # add multi line and multi column text watermark in word
C # add multi line and multi column text watermark in word
2022-07-25 19:38:00 【51CTO】
In general , stay Word Adding a text watermark in only supports adding a text watermark , But in a complex office environment , Due to the design requirements of different documents , Need to be in Word Add tile watermark effect to the document , That is, the watermark text in the document exists in the form of multi line and multi column distribution . This paper will introduce how to realize the watermark effect , Here are the detailed steps and methods .
dll quote
adopt NuGet introduce dll(2 Methods ) Methods
1. Can be in Visual Studio Open in “ Solution explorer ”, Right click “ quote ”,“ management NuGet package ”, And then the search “Free Spire.Doc”, Click on “ install ”. Wait for the program installation to complete .
2. Copy the following to PM Console installation :
Manually add dll Quoted method
Can be manually Download package To local , Then decompress , find BIN Under folder Spire.Doc.dll. And then in Visual Studio Open in “ Solution explorer ”, Right click “ quote ”,“ Add reference ”, The local path BIN Under folder dll Add a reference to the program .
Add multi line and multi column text watermark
stay Word When adding multi line text watermark in , The way to achieve this is to add shape WordArt in the header , The watermark effect of multi line text is simulated by copying the shape many times . The following are the main code steps to realize watermark addition :
- establish Document Class object , And call Document.LoadFromFile(string fileName) Method loading Word file .
- establish ShapeObject Class , And pass ShapeObject.Width、ShapeObject.Height、ShapeObject.VerticalPosition、ShapeObject.Rotation、ShapeObject.WordArt.Text、ShapeObject.WordArt.FontFamily、ShapeObject.FillColor And other properties to set the shape size 、 Location 、 Rotation Angle 、 Watermark text 、 Font and color, etc .
- for Loop through all Section, adopt Section.HeadersFooters.Header Property to get the header , And HeaderFooter.AddParagraph() Method to add a paragraph to the header .
- adopt for Cycle to ShapeObject.Clone() Method copies the shape multiple times , And pass ShapeObject.VerticalPosition and ShapeObject.HorizontalPosition Property to set the shape position arrangement .
- call Paragraph.ChildObjects.Add(IDocumentObject entity) Method to add a shape to the header paragraph .
- Last , adopt Document.SaveToFile(string fileName, FileFormat fileFormat) Method to save the document to the specified path .
C#
VB.NET
Watermark effect :

—END—
边栏推荐
- GBASE 8s UDR内存管理_03_mi_realloc
- Network packet multi-layer transmission demonstration
- 软件设计师下午真题:2009-2022
- Leetcode skimming: dynamic programming 07 (different binary search trees)
- 重磅!《几何深度学习》新书发布,帝国理工/DeepMind等图ML大牛共同撰写,160页pdf阐述几何DL基础原理和统一框架
- 某公司网络设计与规划
- Small program completion work wechat campus maintenance application small program graduation design finished product (2) small program function
- Imperial cms7.5 imitation "question and answer library" question and answer learning platform website source code with mobile version
- 微信小程序10-微搭模板
- 英诚医院内部网络规划与设计
猜你喜欢

微信小程序开发之全局配置与页面配置

授权无线通信标准

Legal mix of collations for operation 'Union' (bug record)

Flutter 小技巧之优化你使用的 BuildContext

IP地址的概念

打印数据库返回的查询数据是null,或者是默认值。与数据库返回的值不相符

919. 完全二叉树插入器

How to ensure the consistency of double write between database and cache?
![[artifact] screenshot + mapping tool snipaste](/img/d2/a9a706a114641094e32ab5c6193f58.png)
[artifact] screenshot + mapping tool snipaste

leetcode刷题:动态规划07(不同的二叉搜索树)
随机推荐
leetcode刷题:动态规划07(不同的二叉搜索树)
C language learning diary 3 - realloc function
Flutter tips: optimizing the buildcontext you use
Binary tree visualization
手机端触摸图片slider轮播插件photoswipe.js
【神器】截图+贴图工具 Snipaste
微信小程序开发之WXSS模板样式与WXS脚本语言
Imeta | sangerbox: interactive integrated clinical information analysis platform
什么是唯心主义
Wechat applet 10 - wechat template
ERROR: role “admin“ cannot be dropped because some objects depend on itDETAIL:
Improvement of wechat applet 28 hot search list ①
二叉树可视化
新瓶装老酒--近期APT32(海莲花)组织攻击活动样本分析
英诚医院内部网络规划与设计
加州大学|用于未指定环境的可行对抗鲁棒强化学习
六轴传感器使用学习记录
Leetcode skimming: dynamic programming 07 (different binary search trees)
Oracle数据库下载、安装、使用教程及问题汇总
Kcon 2022 highlights and agenda revealed!