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.

Wed Mar 13, 2019 9:10 am

Hello,
I have a textbox defined like this:

Dim tbhdrTitolo As TextBox = ParIntestazione.AppendTextBox(800, 50)
Dim parhdrTitolo As Paragraph = tbhdrTitolo.Body.AddParagraph()
parhdrTitolo.AppendText(Biglietto.hdrTitolo).ApplyCharacterFormat(fTiti16B)
tbhdrTitolo.Format.TextAnchor = ShapeVerticalAlignment.Center

tbhdrTitolo.Format.HorizontalPosition = 10
tbhdrTitolo.Format.VerticalPosition = 150
tbhdrTitolo.Format.FillColor = Drawing.Color.FromArgb(179, 166, 218)
tbhdrTitolo.Format.LineColor = Drawing.Color.White

The backcolor is a violet (not very light), I want to set the linecolor at white, but it is set automatically to black.
How can I set it to White?
thank you in advance,
Paola

paolagumi
 
Posts: 81
Joined: Tue Apr 21, 2015 11:32 am

Wed Mar 13, 2019 9:48 am

lo,

Thanks for your inquiry.
I simulated your scenario with the latest Spire.Doc Pack(hot fix) Version:7.3.3, but didn't found any problem, the line color of textbox was set to white successfully. Attached my full testing code and generated Word file for your reference. If you were using an old version, I would suggest that you download the latest one to have a try. If the issue still occurs on your side, we need your full testing code and your generated file to do further investigation. Also please tell us your system configuration (E.g. Windows 7 64-bit) along with the region setting (E.g. China Chinese).
Code: Select all
'create a document and add a section
Dim document As New Document()
document.AddSection()

'define character format
Dim fTiti16B As New Spire.Doc.Formatting.CharacterFormat(document)
fTiti16B.FontSize = 20
fTiti16B.TextColor = Color.Red

'insert and format textbox
Dim tbhdrTitolo As TextBox = document.Sections(0).AddParagraph().AppendTextBox(400, 50)
Dim parhdrTitolo As Paragraph = tbhdrTitolo.Body.AddParagraph()
parhdrTitolo.AppendText("Textbox in Word Document").ApplyCharacterFormat(fTiti16B)
tbhdrTitolo.Format.TextAnchor = ShapeVerticalAlignment.Center

tbhdrTitolo.Format.HorizontalPosition = 10
tbhdrTitolo.Format.VerticalPosition = 150
tbhdrTitolo.Format.FillColor = Color.FromArgb(179, 166, 218)
tbhdrTitolo.Format.LineColor = Color.White

'save the file
document.SaveToFile("TextBox.docx", FileFormat.Docx2013)

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Wed Mar 13, 2019 10:05 am

Hello Nina,
thank you very much for your answer.
I'm using windows 7 at 64 bits, I'm in Italy and using Spire.office versione 3.6.0.


The strange thing is that if I set a darker fillcolor (like black),
the line color is correctly set to white,
but my fillcolor (179, 166, 218) is not very light!!

I've modified the ftiti16B font, with:
fTiti16B.TextColor = Drawing.Color.White
before creating the textbox, and so it works.

But why does it not work simply with:
'tbhdrTitolo.Format.LineColor = Drawing.Color.White' ?

Another question: is there a newer version for Spire.office, after the 3.6.0 I'm using?

thank you and best regards,
Paola

paolagumi
 
Posts: 81
Joined: Tue Apr 21, 2015 11:32 am

Thu Mar 14, 2019 2:46 am

Hi,

Thanks for your prompt reply.
Please note that the setting tbhdrTitolo.Format.LineColor = Drawing.Color.White acts on the border color of textbox rather than the color of text. As your seen, the text color will switch between black and white according to the fill color of textbox. Actually, the behavior is based on the MS Word's own design. If you set the fill color RGB(179, 166, 218) to textbox in MS Word, you will see the text color is black by default. Our Spire.Doc mimics the behaviors of MS Word, hence you got the black text color using our product. For you case, please add the following code to set white color for text.
BTW, at present the latest Spire.Office is Spire.Office Platinum (DLL Only) Version:4.3.1, welcome to download the latest one.
Code: Select all
fTiti16B.TextColor = Drawing.Color.White;

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Thu Mar 14, 2019 9:56 am

Hi Nina,
thank you very much for your answer, it's all clear to me now.
I'll dowload Spire Office platinum 4.3.1 as soon as possible.

Best regards,
Paola

paolagumi
 
Posts: 81
Joined: Tue Apr 21, 2015 11:32 am

Thu Mar 14, 2019 10:51 am

Hi,

Thanks for your feedback.
If you need assistance in the future, please do not hesitate to contact us.
Wish you all the best!

Yours sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.Doc

cron