当前位置:网站首页>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—
边栏推荐
- 安全基础4 ---正则表达式
- Network data request for wechat applet development
- 打印数据库返回的查询数据是null,或者是默认值。与数据库返回的值不相符
- what is qml in qt
- Old wine in new bottles -- sample analysis of recent apt32 (sea Lotus) organizational attacks
- Telnet installation and telnet (correct password) cannot log in!
- leetcode刷题:动态规划07(不同的二叉搜索树)
- 前夕 - 0day威胁情报
- 加州大学|用于未指定环境的可行对抗鲁棒强化学习
- Empire CMS whole station | mobile number /qq lianghao mall source code | suitable for mobile terminal
猜你喜欢

某公司网络设计与规划

Openresty Lua resty mlcache multi-level cache

KCon 2022 亮点及议程大揭秘!

六轴传感器使用学习记录

高端旗舰投影仪选购指南:当贝X3 Pro、当贝F5观影更沉浸!

Beihang and other "deep learning event extraction" literature review paper, 27 page PDF describes the current trend

Hongke shares | how to solve blackmail software security vulnerabilities

A high efficiency 0-delay 0-copy QT player scheme based on Hisilicon 3559

Add a subtitle of 3D effect to the container

Network packet multi-layer transmission demonstration
随机推荐
Common misunderstandings caused by a time reporting assistant of Blue Bridge Cup basic questions
How many lines of code is appropriate for a function? Clean Code
C语言学习日记3——realloc函数
阿姆利塔工程学院|用于情感分析的方面术语提取中优化采样的强化主动学习方法
蓝桥杯基础练习——矩阵的回形取数(C语言)
Swift 基础 Codable(JSONEncoder JSONDecoder)的使用
Grid layout frequently asked interview questions
What is idealism
Imperial cms7.5 imitation "question and answer library" question and answer learning platform website source code with mobile version
Real estate industry reshuffle
Improvement of wechat applet 29 hot search list ②
Wechat applet 10 - wechat template
[artifact] screenshot + mapping tool snipaste
[CSAPP Practice Problem 2.32] tsub_ok(int x, int y)判断补码减法是否溢出
网络数据包多层传输演示
Solve the problem that the win10 account has no administrator rights
Scala基础【集合01】
Imeta | sangerbox: interactive integrated clinical information analysis platform
Heavy! The new book "deep learning in geometry" was released, which was jointly written by imperial Institute of technology /deepmind and other figures ml Daniel. The 160 page PDF expounds the basic p
Network packet multi-layer transmission demonstration