DataGridView - bold text in a cell

0
0

We use Roboto font as our primary font throughout the application. We’ve installed the font on the server, on our client and we still have a problem.

We have a DataGridView with a text column, with AllowHTML set to True, however we can’t set a portion of the text in that column to bold unless we change the font to something like Arial or Tahoma. We’ve tried ‘b’ and ‘strong’ tags, plus ‘font-weight’ and none of them work with Roboto.

This is our source code:

if (isEven)
mFN.SetCellValue(gRow[“Testing”], “<b>This is a </b>Roboto”);
else
mFN.SetCellValue(gRow[“Testing”], “<span style=’font-family:Arial’><strong>This is a </strong>Arial</span>”);

SetCellValue() is just a method that sets the value of the Cell to the text. I’ve attached a screen shot of the result.

Is there a way of doing this with Roboto?

Attachment
  • You must to post comments
0
0

Works fine in our browser and with your demo app, but not with ours. I think it may be a clash with the theme we have.

If Roboto is installed on the server, do we need to specify it as a source using the data:font or can we just use Roboto? I’ve attached a screen shot.

Attachment
  • Neil Hoskins
    It is definitely something to do with our theme; I loaded our theme against your sample project and same problem.
  • Julie (ITG)
    The font installed on the server is for the server to use. Wisej.NET uses it to measure text when AutoSize is true. The browsers on the user’s machines generally don’t have the Roboto font installed. It’s either installed by the user on Windows or installed by the browser and only for the browser using css. If the server has the font installed and it happens to be the same machine using the browser (ie localhost for debugging) then the font is available to the browser and any other app on that machine.
  • Neil Hoskins
    Hi Julie – I have Roboto installed on my dev machine and it won’t work and it’s definitely to do with our theme. I think only the regular font is implemented in the Theme through the ‘LoadData’ option, so html won’t affect it. The weird thing is that bolding the whole cell using FontStyle.Bold works fine. I thought the client would have to have the font installed for it to show correctly.
  • You must to post comments
0
0

Since you’re using html, it likely has nothing to do with Wisej. Try to set the font to bold Roboto with a simple html page and see if you get the same result.

If it’s also not working with a html page, you can download Roboto here: https://fonts.google.com/selection?query=roboto Make sure to unzip the file and right-click “install”, especially on “Roboto-Bold.ttf”

Font installation instructions: https://support.microsoft.com/en-us/office/add-a-font-b7c5f17c-4426-4b53-967f-455339c564c1

After installing Roboto on my machine, it works for me, in both a simple HTML page and in a Wisej project.

I’ve included a zip file with the test html page and the test Wisej project.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.