打印预览报告时,数据量超过30条时,预览就死机,当我取出循环前20条数据时,则可以正常预览 ,其实数据量也不是很大,一共就添加了61条测试数据..程序每次都执行完了,也没发现死循环,就是预览不出来,急求高手帮忙解决..小弟在此谢谢了,第一次提问,问题可能提的不好,请见谅!以下为循环打印代码
//******
这之间的数据量多点就会造成CPU 100%,调试时都见程序运行完了,并没发现死循环,就时预览时会卡死...
//******
  
lsText = new TextStyle(TextStyle.Normal);           // 样式 
lsText.StringAlignment = StringAlignment.Near;
lsText.Size = 12.0f;
lsText.Bold = true;
 ffText=new FontFamily("宋体");
lsTitle.FontFamily=ffText;
builder.AddTextSection("\n\n二、异常和疾病情况:",lsText);
lsText = new TextStyle(TextStyle.Normal);           // 样式 
lsText.StringAlignment = StringAlignment.Near;
lsText.Size = 11.0f;
lsText.Bold = false;
ffText=new FontFamily("宋体");
lsTitle.FontFamily=ffText;
//LCF 04 28 2007
// if(ht.Count == 0)
 if(iden.Count==0)
//LCF
{
builder.AddTextSection("无",lsText);
}
DataTable tbjbyc = new DataTable();
tbjbyc.Columns.Add(new DataColumn("异常和疾病名称",typeof(string)));
//LCF 05 11 2007
tbjbyc.Columns.Add(new DataColumn("姓名",typeof(string)));
//LCF
tbjbyc.Columns.Add(new DataColumn("人数",typeof(string)));
tbjbyc.Columns.Add(new DataColumn("所占百分比",typeof(string)));
//LCF
/// IDictionaryEnumerator ide = ht.GetEnumerator();
//LCF
builder.AddTextSection("\n");
//LCF 02 28 2007

foreach(DictionaryEntry de in iden)
{

dr = tbjbyc.NewRow();
//LCF 05 11 20007

dr[0] = de.Key.ToString(); //illness name

dr[1]= ((Sympton)de.Value).PersonName;
dr[2] = ((Sympton)de.Value).Count;// person count
dr[3] = decimal.Round((Convert.ToDecimal(((Sympton)de.Value).Count)/dwaccount)*100,2)+"%";
//LCF //*******************************************
//当数据记录达到20条时,跳出循环..
// if(tbjbyc.Rows.Count == 20)
// {
// break;
// }
                                        //*******************************************
tbjbyc.Rows.Add(dr);

} //LCF //***************************************************************** if(tbjbyc.Rows.Count > 0)
{
builder.DefaultTablePen = null;//reportDocument.NormalPen;
builder.AddTable (tbjbyc.DefaultView, true, 100f);
builder.DefaultColumnAlignment = ReportPrinting.HorizontalAlignment.Center;
builder.AddColumn("异常和疾病名称","异常和疾病名称",2.3f,true,true);
builder.AddColumn("姓名","姓名",3.0f,true,true);
builder.AddColumn("人数","人数",1.0f,true,true);
builder.AddColumn("所占百分比","所占百分比",1.0f,true,true);
builder.Table.InnerPenHeaderBottom = reportDocument.NormalPen;
builder.Table.InnerPenRow = new Pen (Color.Gray, reportDocument.ThinPen.Width);
builder.Table.OuterPenBottom = new Pen (Color.Gray, reportDocument.ThinPen.Width);
builder.DefaultColumnAlignment = ReportPrinting.HorizontalAlignment.Left; // put it back
//LCF
} //****************************************************************** lsText = new TextStyle(TextStyle.Normal);           // 样式 
lsText.StringAlignment = StringAlignment.Near;
lsText.Size = 12.0f;
lsText.Bold = true;
ffText=new FontFamily("宋体");
lsTitle.FontFamily=ffText;
builder.AddTextSection("\n\n三、健康建议:",lsText);
lsText = new TextStyle(TextStyle.Normal);           // 样式 
lsText.StringAlignment = StringAlignment.Near;
lsText.Size = 11.0f;
lsText.Bold = false;
ffTitle=new FontFamily("宋体");
lsText.FontFamily=ffTitle;

HCIS7.BusinessLogic.BLL.Symptons s=new Symptons();
this.list = s.getdwsymptons();
for(int i=0;i<list.Count;i++)
{
if(((Sympton)list[i]).Dwid==TttjReport._statisticInfo.Dwid && ((Sympton)list[i]).Edate==TttjReport._statisticInfo.Examdate)
{
string adv= ((Sympton)list[i]).TTAdvice;     //存在修改的团检建议
builder.AddTextSection("\n");
builder.AddTextSection(adv,lsText); lsText = new TextStyle(TextStyle.Normal);           // 样式 
lsText.StringAlignment = StringAlignment.Far;
lsText.Size = 12.0f;
lsText.Bold = true;
ffTitle=new FontFamily("宋体");
lsText.FontFamily=ffTitle;
   
builder.FinishLinearLayout ();
return;
}
}
if (iden.Count==0)//生成团检建议
{
builder.AddTextSection("无",lsText);
}

DataTable tbjy = new DataTable();
tbjy.Columns.Add(new DataColumn("异常和疾病名称",typeof(string)));
tbjy.Columns.Add(new DataColumn("建议内容",typeof(string)));
////////////////////////////////

HealthAdvice infile=null;
DictionaryEntry fo;
bool ispos=true;
foreach(DictionaryEntry sym in iden)
{
if (medicalTreatment.HealthDictionary.M_Instance.Search(StrTool.StringFilter(sym.Key.ToString()))!=null)
{
foreach (object foundInFile in medicalTreatment.HealthDictionary.M_Instance.Search(StrTool.StringFilter(sym.Key.ToString()))) 
{
// build the HTML output in the sorted list, so the 'unsorted'
// searchResults are 'sorted' as they're added to the SortedList
fo = (DictionaryEntry)foundInFile; infile = (HealthAdvice)fo.Key;

ArrayList rank = (ArrayList)fo.Value;
foreach(object sy in rank)
{
string str=sy.ToString();
bool fs=false;
foreach(DictionaryEntry syms in iden)
{
if (string.Compare(syms.Key.ToString().ToLower(),str)==0)
{
fs=true;
break;
}
}
if (fs==false)
{
break;
}
if (fs==false)
{
ispos=false;
}
}

if (ispos==true)
{
dr = tbjy.NewRow();
dr[0] = infile.Title;//illness name
dr[1] = infile.Description;//advice
tbjy.Rows.Add(dr);
}
else
{
ispos=true;
}
}
}
} builder.AddTextSection("\n");
//***********************************************// if(tbjy.Rows.Count > 0)
// {
// //LCF 05 17 2007
//
// builder.DefaultTablePen = null;//reportDocument.NormalPen;
// builder.AddTable (tbjy.DefaultView, true, 100f);
//// builder.DefaultColumnAlignment = ReportPrinting.HorizontalAlignment.Center;
// builder.AddColumn("异常和疾病名称","异常和疾病名称",0.8f,true,true);
// builder.AddColumn("建议内容","建议内容",3.6f,true,true);
// builder.Table.InnerPenHeaderBottom = reportDocument.NormalPen;
// builder.Table.InnerPenRow = new Pen (Color.Gray, reportDocument.ThinPen.Width);
// builder.Table.OuterPenBottom = new Pen (Color.Gray, reportDocument.ThinPen.Width);
// builder.DefaultColumnAlignment = ReportPrinting.HorizontalAlignment.Left; // put it back
//
// //LCF
// }
// else
// {
// builder.AddTextSection("无建议",lsText);
// }
//
//***********************************************