B2021-034 Sigle cell table with just a jpg in the cell caused PROMS to crash.

Wolf Creek data: Maintenance; Mechanical; MPM; MPM KJ-004: 7.1.4 Table
This commit is contained in:
John Jenko 2021-03-26 19:23:43 +00:00
parent 25b9af0d7c
commit 380dd2ceac

View File

@ -1,4 +1,5 @@
using System;
using System;
using System.Collections.Generic;
using System.Text;
using C1.Win.C1FlexGrid;
@ -556,39 +557,39 @@ public string Path
// B2017-105 if a symbol character was set to a bigger font size, then the positioning of the larger symbol character was printing too high on the line
// found with Wolf Creek use of the empty box symbol
private float BiggestFontSize(Paragraph myPara)
{
float fontSize = 12;
foreach (Chunk ck in myPara.Chunks)
{
fontSize = Math.Max(fontSize, ck.Font.Size);
if (ck.Font.Size > 12)
{
ck.SetTextRise(-2f);
//_MyLog.WarnFormat("set text rise");
}
}
return fontSize;
}
//private float BiggestFontSize(Paragraph myPara)
//{
// float fontSize = 12;
// foreach (Chunk ck in myPara.Chunks)
// {
// fontSize = Math.Max(fontSize, ck.Font.Size);
// if (ck.Font.Size > 12)
// {
// ck.SetTextRise(-2f);
// //_MyLog.WarnFormat("set text rise");
// }
// }
// return fontSize;
//}
// B2017-233, B2017-234 needed to get the smallest font size to help decide if a vertical adjustment of the text is needed in a table cell
private float SmallestFontSize(Paragraph myPara)
{
float fontSize = 30;
foreach (Chunk ck in myPara.Chunks)
{
fontSize = Math.Min(fontSize, ck.Font.Size);
}
return fontSize;
}
private void ShowChunks(System.Collections.ArrayList chunks) // RHM20150429 - Table Scrunch
{
StringBuilder sb = new StringBuilder();
foreach (Chunk chk in chunks)
{
sb.Append(BuildChunks(chk.Content));
}
//if (ShowDetails) Console.WriteLine("Chunks = '{0}'", sb.ToString());
}
//private float SmallestFontSize(Paragraph myPara)
//{
// float fontSize = 30;
// foreach (Chunk ck in myPara.Chunks)
// {
// fontSize = Math.Min(fontSize, ck.Font.Size);
// }
// return fontSize;
//}
//private void ShowChunks(System.Collections.ArrayList chunks) // RHM20150429 - Table Scrunch
//{
// StringBuilder sb = new StringBuilder();
// foreach (Chunk chk in chunks)
// {
// sb.Append(BuildChunks(chk.Content));
// }
// //if (ShowDetails) Console.WriteLine("Chunks = '{0}'", sb.ToString());
//}
private string BuildChunks(string str)
{
StringBuilder sb = new StringBuilder();
@ -1026,8 +1027,11 @@ public string Path
// - only need for the first line of table cell text
private float GetLargestFontSize(vlnCell vc)
{
// B2021-034 WCN Maintenance; Mechanical; MPM; MPM KJ-004: 7.1.4 Table
// has single cell table with just a jpeg image
// need to specify MyPara.Chunks in stead of foreach Chunk in MyPara
float largestFontSize = 12;
foreach (Chunk ck in vc.MyPara)
foreach (Chunk ck in vc.MyPara.Chunks)
{
if (ck.Content.EndsWith("\n"))
break; // end of first line