当前位置:网站首页>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—
边栏推荐
- Security foundation 6 - vulnerability recurrence
- University of California | feasible confrontation robust reinforcement learning for unspecified environments
- 【刷题记录】21. 合并两个有序链表
- [record of question brushing] 21. Merge two ordered linked lists
- Improvement of wechat applet 28 hot search list ①
- [artifact] screenshot + mapping tool snipaste
- How to be a self disciplined person?
- Analysis of CMS station building system of common PHP in China
- Imperial cms7.5 imitation "question and answer library" question and answer learning platform website source code with mobile version
- [reading notes] deep learning Chapter 1: Introduction
猜你喜欢

基于PHP的中非南南合作信息交流平台网站建设

蓝桥杯基础练习——矩阵的回形取数(C语言)

重磅!《几何深度学习》新书发布,帝国理工/DeepMind等图ML大牛共同撰写,160页pdf阐述几何DL基础原理和统一框架

Monitor MySQL based on MySQL exporter

Small program completion work wechat campus maintenance application small program graduation design finished product (2) small program function

软件设计师下午真题:2009-2022

The JS paging plug-in supports tables, lists, text, and images

TFIDF examples and explanations

基于海思3559 高效率的 0延时 0拷贝 qt播放器方案

Eve - 0day Threat Intelligence
随机推荐
Oracle database download, installation, use tutorial and problem summary
Imeta | sangerbox: interactive integrated clinical information analysis platform
[CSAPP Practice Problem 2.32] tsub_ OK (int x, int y) judge whether complement subtraction overflows
Split very long line of words into separate lines of max length
北航等《深度学习事件抽取》文献综述论文,27页pdf阐述当前趋势
Creative drop-down multi choice JS plug-in download
Telnet installation and telnet (correct password) cannot log in!
解决Win10账户没有了管理员权限
How to analyze qiime2 after obtaining picrust2 results
Kcon 2022 highlights and agenda revealed!
Why learn service grid istio
AAAI 2022 | GAN的结构有“指纹”吗?从伪造图像溯源生成网络结构
哈希无向图可视化
Wechat campus maintenance and repair applet graduation design finished product (5) assignment of applet completion work
How to be a self disciplined person?
Scala foundation [set 01]
授权无线通信标准
[good book recommendation] - authoritative guide to Ethernet (2nd Edition)
Binary tree visualization
Analysis of CMS station building system of common PHP in China