Spire.Doc Samples (6)
Upload
Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
Source file:
filename
fileerrors
Set text watermark
Text: | |
Font: | |
Font Size: | |
Color: | |
downloads
|
Set image watermark
Image: |
Click here to browse files
|
downloads
|
- Demo
- Java
- C# source
This demo shows you how to add text watermark and image watermark to Word document.
import com.spire.doc.Document; import com.spire.doc.FileFormat; import com.spire.doc.PictureWatermark; import com.spire.doc.TextWatermark; import com.spire.doc.documents.WatermarkLayout; import java.awt.*; import java.io.ByteArrayInputStream; import java.util.UUID; public class AddWatermark { public void addWaterMark(String docFile, String WaterMarkType, String watermarkText, String imageFile, String resultFilePath) { Document document = new Document(); document.loadFromFile(docFile); switch (WaterMarkType) { case "Text": addTextWatermark(document, watermarkText); break; case "Image": addImageWatermark(document, imageFile); break; } document.saveToFile(resultFilePath, FileFormat.Docx); } private void addImageWatermark(Document doc, String imageFile){ PictureWatermark pictureWatermark=new PictureWatermark(); pictureWatermark.setPicture(imageFile); pictureWatermark.setScaling(250); pictureWatermark.isWashout(false); doc.setWatermark(pictureWatermark); } private void addTextWatermark(Document doc, String watermarkText){ TextWatermark textWatermark=new TextWatermark(); textWatermark.setText(watermarkText); textWatermark.setFontSize(14); textWatermark.setColor(Color.RED); textWatermark.setLayout(WatermarkLayout.Diagonal); doc.setWatermark(textWatermark); } }
No Matter How Big or Small Your Project is,
Any technical question related to our product, contact us at support@e-iceblue.com.
Any question related to the purchase of product, contact us at sales@e-iceblue.com.
If you don't find the function you want, please request a free demo from us.
Published in
Spire.Doc Samples
Agreement Start Date: | |
Agreement End Date: | |
Agreement Extension Date: | |
Documentation Start Date: | |
Documentation End Date: | |
downloads
|
- Demo
- Java
- C# source
This demo shows you how to merge some data into a Word template. Our Spire.Doc provides also the function NestedMailMerge with which you can merge the main-table and sub-table into a Word template to get a professional report. You can get a full demo from the article How to Use Mail Merge to Create Report
import com.spire.doc.Document; import com.spire.doc.FileFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; public class MailMargeDemo { public void mailMerge(String docFile, String resultFilePath) throws Exception { Document doc = new Document(); doc.loadFromFile(docFile); SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar=Calendar.getInstance(); ArrayList dateList=new ArrayList<>(); int []offset={-5,5,6,-2,2}; for(int data:offset){ calendar.setTime(new Date()); calendar.add(Calendar.YEAR,data); dateList.add(format.format(calendar.getTime())); } String[] values =new String[dateList.size()]; dateList.toArray(values); String []fields={ "SubGrantPAStartDateValue", "SubGrantPAEndDateValue", "SubGrantPAExtensionDateValue", "SubGrantPSStartDateValue", "SubGrantPSEndDateValue" }; doc.getMailMerge().execute(fields,values); doc.saveToFile(resultFilePath, FileFormat.Docx); } }
No Matter How Big or Small Your Project is,
Any technical question related to our product, contact us at support@e-iceblue.com.
Any question related to the purchase of product, contact us at sales@e-iceblue.com.
If you don't find the function you want, please request a free demo from us.
Published in
Spire.Doc Samples
Data
Name | Capital | Continent | Area | Population | Flag |
Argentina | Buenos Aires | South America | 2777815 | 32300003 | |
Bolivia | La Paz | South America | 1098575 | 7300000 | |
Brazil | Brasilia | South America | 8511196 | 150400000 | |
Canada | Ottawa | North America | 9976147 | 26500000 | |
Chile | Santiago | South America | 756943 | 13200000 | |
Colombia | Bagota | South America | 1138907 | 33000000 | |
Cuba | Havana | North America | 114524 | 10600000 | |
Ecuador | Quito | South America | 455502 | 10600000 | |
El Salvador | San Salvador | North America | 20865 | 5300000 | |
Guyana | Georgetown | South America | 214969 | 800000 |
Option
downloads
- Demo
- Java
- C# source
This demo shows you how to create a table with specified data in a Word document. We also show you how to set the border and background color of the table.
No Matter How Big or Small Your Project is,
Any technical question related to our product, contact us at support@e-iceblue.com.
Any question related to the purchase of product, contact us at sales@e-iceblue.com.
If you don't find the function you want, please request a free demo from us.
Published in
Spire.Doc Samples
Published in
Spire.Doc Samples
Upload
Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
fileerrors
Convert to
Source file:
filename
Search Text:
- Demo
- Java
- C# source
This demo shows you how to search text in a Word document and highlight the text matched.
import com.spire.doc.Document; import com.spire.doc.FileFormat; import com.spire.doc.documents.TextSelection; import java.awt.*; public class FindHighlightDemo { public void findHeighlight(String docFile, String findText, String resultFilePath){ Document doc = new Document(); doc.loadFromFile(docFile); TextSelection[] textSelections = doc.findAllString(findText, false, true); if(textSelections!=null){ for (TextSelection selection : textSelections) { selection.getAsOneRange().getCharacterFormat().setHighlightColor(Color.YELLOW); } } doc.saveToFile(resultFilePath, FileFormat.Docx); } }
No Matter How Big or Small Your Project is,
Any technical question related to our product, contact us at support@e-iceblue.com.
Any question related to the purchase of product, contact us at sales@e-iceblue.com.
If you don't find the function you want, please request a free demo from us.
Published in
Spire.Doc Samples
Upload
Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
fileerrors
Convert to
Source file:
filename
Target file type:
- Demo
- Java
- C# source
This demo shows you how to convert a Word document (doc/docx) to PDF, HTML, Image, XPS, RTF and other file format.
No Matter How Big or Small Your Project is,
Any technical question related to our product, contact us at support@e-iceblue.com.
Any question related to the purchase of product, contact us at sales@e-iceblue.com.
If you don't find the function you want, please request a free demo from us.
Published in
Spire.Doc Samples