Classic ASP - controlling borders of paragraph

The following code displays a paragraph will all the borders displayed, how can the left and right borders be removed ?

' Set paragraph borders
Builder.ParagraphFormat.Borders.DistanceFromText = 5
Builder.ParagraphFormat.Borders.LineWidth = 2
Builder.ParagraphFormat.Borders.LineStyle = 2
Builder.Writeln("Bordered Text")

Here is the code:

’ hide left border

Builder.ParagraphFormat.Borders.Item(1).LineStyle 0

’ hide right border

Builder.ParagraphFormat.Borders.Item(2).LineStyle 0

Values for enumeration types as well as some other useful info about using Aspose.Words from classical ASP can be found in the following wiki article:

https://docs.aspose.com/words/net/supported-platforms/#com

Best regards,

Had to insert ‘=’ before the 0 but then it did hide the left and right borders. However when opened with Word 2000 the following error is encountered.

integer divide by zero

0xc0000094 in the application at 0x3015176a

I can post the test file if appropriate

regards

Garth Rees

Yes, please attach the test file.

Best regards,

Test file attached. (Extension changed to from ASP to TXT to simplify attachment.)

Since my last post we have found that Word2003 displays the file correctly, but Word 2002 and 2000 do not.

regards

Garth Rees

I have noticed that the doc.Save_4 stream, 0 line is changed to doc.Save_4 stream, 1 . It actually saves document in plain text format. Maybe this is what causes the error?

If I change the statement to doc.save_4 stream, 0 then I get the following error
Aspose.Words classical ASP sample
Test Number:-

Aspose.Words error ‘80070057’

Invalid file format requested.

/lib/asposedemo.asp, line 103

Yes, you are right. The SaveFormat enumeration actually starts from 1. I have fixed the related Wiki article.

The problem in your test application is related to an already logged problem of changing Border.LineStyle to/from LineStyle.None. MS Word 2000 and 2002 require that LineWidth should be 0 when Border.LineStyle is set to LineStyle.None and be greater than 0 if Border.LineStyle is set to value other than LineStyle.None. We have added a fix in the next version that will automatically readjust LineWidth to be consistent to current LineStyle setting.

Meanwhile, as a workaround, you should always keep LineWidth consistent with LineStyle when you change LineStyle or LineWidth properties. For example, use

Builder.ParagraphFormat.Borders.Item(1).LineStyle = 0

Builder.ParagraphFormat.Borders.Item(1).LineWidth = 0

to hide the left border of a paragraph.

Best regards,