Crystal 报告 GetAttributes
Crystal Reports GetAttributes
我被要求查看 1000 多份 Crystal 报告以查找每份报告中使用的商店程序 and/or Table 名称。我想以编程方式执行此操作,但我没有看到太多从 CR 对象模型读取此类值的方法。
ReportDocument 对象上有一个 GetAttributes 方法,但我不知道那是否是正确的地方。
有什么建议吗?
GetAttributes 不是我需要的。这是我使用的(使用目录中的文件列表...)
foreach (string repFile in filePaths)
{
string reportName = repFile.ToString().Replace(folderPath, "");
string tableName = string.Empty;
string cmdText = string.Empty;
string storedProc = string.Empty;
try
{
cryRpt.Load(repFile);
}
catch (Exception rptErr)
{
lblResults.Text += reportName + " - generated Error: " + rptErr.Message + Environment.NewLine; ;
}
cmdText = cryRpt.RecordSelectionFormula.ToString();
foreach (Table tab in cryRpt.Database.Tables)
{
if (tab.Name.ToUpper().Contains("RPT_") || tab.Name.ToUpper().Contains("SP_"))
{
storedProc = tab.Name;
}
else
{
tableName = tab.Name;
}
}
我被要求查看 1000 多份 Crystal 报告以查找每份报告中使用的商店程序 and/or Table 名称。我想以编程方式执行此操作,但我没有看到太多从 CR 对象模型读取此类值的方法。
ReportDocument 对象上有一个 GetAttributes 方法,但我不知道那是否是正确的地方。
有什么建议吗?
GetAttributes 不是我需要的。这是我使用的(使用目录中的文件列表...)
foreach (string repFile in filePaths)
{
string reportName = repFile.ToString().Replace(folderPath, "");
string tableName = string.Empty;
string cmdText = string.Empty;
string storedProc = string.Empty;
try
{
cryRpt.Load(repFile);
}
catch (Exception rptErr)
{
lblResults.Text += reportName + " - generated Error: " + rptErr.Message + Environment.NewLine; ;
}
cmdText = cryRpt.RecordSelectionFormula.ToString();
foreach (Table tab in cryRpt.Database.Tables)
{
if (tab.Name.ToUpper().Contains("RPT_") || tab.Name.ToUpper().Contains("SP_"))
{
storedProc = tab.Name;
}
else
{
tableName = tab.Name;
}
}