Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.
Mon Jan 15, 2018 7:08 pm
Hi, I'd like to check if doc contains borders (Y/N).
Need VB.Net script.
Kindly help - Thank you!
-
kdr13
-
- Posts: 72
- Joined: Fri Apr 15, 2016 4:35 pm
Tue Jan 16, 2018 3:19 am
Hi,
Thanks for your inquiry.
Please use the below code to check the page borders.
- Code: Select all
Dim word_file_open_dialog As New OpenFileDialog()
If word_file_open_dialog.ShowDialog() = DialogResult.OK Then
Dim document As New Document()
document.LoadFromFile(word_file_open_dialog.FileName)
For Each s As Section In document.Sections
'get all the page borders
Dim bds As Borders = s.PageSetup.Borders
'check if contains any border,
'ture means no border at all, false means at least 1 border on four sides.
Dim isNoBorder As Boolean = bds.NoBorder
'check border details on four sides, eg, top.
Dim topIsNoBorder As Boolean = True
If bds.Top.BorderType <> Spire.Doc.Documents.BorderStyle.None Then
topIsNoBorder = False
End If
Next s
End If
If it is not what you want, please
share your sample document and then we will provide the solution accordingly.
Sincerely,
Jane
E-iceblue support team
-
Jane.Bai
-
- Posts: 1156
- Joined: Tue Nov 29, 2016 1:47 am
Tue Jan 16, 2018 8:03 am
Thank you for your quick reply! - I will check and let you know if it works as expected.
-
kdr13
-
- Posts: 72
- Joined: Fri Apr 15, 2016 4:35 pm
Thu Jan 18, 2018 9:55 am
Hi,
Have you tried the code?
Look forward to your reply.
Sincerely,
Jane
E-iceblue support team
-
Jane.Bai
-
- Posts: 1156
- Joined: Tue Nov 29, 2016 1:47 am
Wed Jan 24, 2018 8:09 am
Tried the code - It looks that it works OK as far as the scenarios checked.
Thank you!
-
kdr13
-
- Posts: 72
- Joined: Fri Apr 15, 2016 4:35 pm
Wed Jan 24, 2018 8:55 am
Hi,
Glad to hear that.
Feel free to contact us if you need any help.
Sincerely,
Jane
E-iceblue support team
-
Jane.Bai
-
- Posts: 1156
- Joined: Tue Nov 29, 2016 1:47 am