FontSize not doing anything

Ok, so I am trying to change the font size on a Text paragraph in a table cell. My code looks like this:

foreach(Row row in table.Rows) {
  foreach(Cell cell in row.Cells) {
    foreach(Text text in cell.Paragraphs) {
      text.TextInfo.FontSize *= 0.8; // I want to scale the font down by 80%
      foreach(Segment seg in text.Segments) // For good measure I try doing it to every segment too.
        seg.TextInfo.FontSize *= 0.8;
}}}

What am I doing wrong? I’ve tried all sorts of things, and I just cannot get the font size to decrease. IN case it matters I am setting text.FontName = “Arial”; too.

Thank you,
~Jason Walker

					}

Hi,

Thank you for considering Aspose.

I use the following code and it worked for me. Please refer to:

foreach (Aspose.Pdf.Row row in table.Rows)
{
foreach (Aspose.Pdf.Cell cell in row.Cells)
{
foreach (Text text in cell.Paragraphs)
{
Aspose.Pdf.TextInfo txtInfo = new Aspose.Pdf.TextInfo();
txtInfo.FontSize = 8;
txtInfo.FontName = "Arial";

foreach (Segment seg in text.Segments)
{
seg.TextInfo = txtInfo;
}
}
}
}

Hope it helps.

Thanks.

Here’s the exact code I’m using (there’s a good deal before this). I’ve commented out the lines I was trying to make my scaling work (scale is a float higher than 0 and lower than 1).

// Apply scaling to row heights.
				foreach(Row row in table.Rows)
				{
					row.FixedRowHeight *= scale;

					foreach(Cell cell in row.Cells)
					{
						// Apply scaling to font sizes.
						foreach(Text text in cell.Paragraphs)
						{
							//text.TextInfo.FontName = "Arial";
							//text.TextInfo.FontSize = /* round down --> */(int)(text.TextInfo.FontSize * scale);
							foreach(Segment seg in text.Segments)
							{
								TextInfo info = new TextInfo();
								info.FontSize = 4;
								info.FontName = "Arial";
								seg.TextInfo = info;
							}
							//text.TextInfo.FontName = "Arial";
						}
					}
				}

Attached is a PDF generated by my code. Obviously the text in it is not 4pts. Is something else going on?

Thank you,
~Jason Walker

Gah… Figured it out, in some arcane corner I was accidentally setting the FontSize back to 11. This works now <_<

Thanks for your time (sorry to waste it). You guys provide some very quick CS, and I appreciate it (and it’s one of the factors that decided which components to use on my project). Thanks again.

~Jason