У меня есть отчет Crystal, у меня есть код, который устанавливает ширину столбца Crystal Report, но проблема заключается в том, что когда код установлен шириной столбца одного столбца с именем BRate, я получил одну ошибку в SubReport. Ниже приведен полный код.
Найдите // комментарий BRate, в котором указан код расположения столбца,
Найдите FieldObject CustomerOtherDetails = (temp1.Subreports ["OtherDetails"]. ReportDefinition.ReportObjects [ "Title1"] как FieldObject); в этой строке я получил сообщение об ошибке «CrystalDecisions.CrystalReports.Engine.InternalException:» Ошибка в файле temp_9f48f70e-1b5f-42b8-8ac4-d8e0b9894445 3320_11720_ {A69A9787-B662-482B-A4DE-258pt. ''
ниже - это кристаллическая привязка дизайна отчета ![Crystal Report MainReport](https://i.stack.imgur.com/ENUgv.png)
Подотчетная привязка ![enter image description here](https://i.stack.imgur.com/vG5Vn.png)
public partial class frmRVInvoiceWithoutForMetal : DockContent
{
public ReportsRPT.rptInvoiceWithoutForMetal temp1;
public string InvNo;
public string InvNoCol;
public string InvType;
public string Entry;
public string ReportTitle;
public string EntryMain;
public string EntryMaster;
public string SubMasterEntryDescription;
public string SubMasterEntryOtherDetails;
public string SubMasterEntryTotal;
public string SubMasterEntryOther;
public string FYearID;
public decimal SizeNo;
public decimal SizeChNo;
public decimal SizeItemName;
public decimal SizeSize;
public decimal SizeHSNCode;
public decimal SizeGSTRate;
public decimal SizePic;
public decimal SizeQuantity;
public decimal SizeBRate;
public decimal SizeRate;
public decimal SizeDiscount;
public decimal SizeValue;
public int MarginLeftRight;
public frmRVInvoiceWithoutForMetal(string entry, string inv, string invtype)
{
FYearID = AppSetting.Instance.FYearID.ToString(); ;
InitializeComponent();
InvNo = inv;
InvType = invtype;
Entry = entry;
EntryMain = Entry + "Main";
EntryMaster = Entry + "Master";
SubMasterEntryDescription = "SubMaster" + Entry + "Description";
SubMasterEntryOtherDetails = "SubMaster" + Entry + "OtherDetails";
SubMasterEntryTotal = "SubMaster" + Entry + "Total";
SubMasterEntryOther = "SubMaster" + Entry + "Other";
if (Entry == "Sales")
{
InvNoCol = DbConst.InvNo;
ReportTitle = InvoiceMaster.Instance.HeaderNameOfSales;
}
else if (Entry == "Purchase")
{
InvNoCol = DbConst.PurNo;
ReportTitle = InvoiceMaster.Instance.HeaderNameOfPurchase;
}
else if (Entry == "PurchaseExp")
{
InvNoCol = DbConst.PurNo;
ReportTitle = InvoiceMaster.Instance.HeaderNameOfPurchaseExp;
}
else if (Entry == "ProformaSales")
{
InvNoCol = DbConst.InvNo;
ReportTitle = InvoiceMaster.Instance.HeaderNameOfProformaSales;
}
else if (Entry == "DebitNote")
{
InvNoCol = DbConst.DBNo;
ReportTitle = InvoiceMaster.Instance.HeaderNameOfDebitNote;
}
else if (Entry == "CreditNote")
{
InvNoCol = DbConst.CRNo;
ReportTitle = InvoiceMaster.Instance.HeaderNameOfCreditNote;
}
rptViewer.EnableDrillDown = false;
int CompnayId = AppSetting.Instance.CompanyID;
string LedgerAddressid = CnUtils.CnMethods.SelectWhere(SubMasterEntryOtherDetails, InvNoCol, InvNo, DbConst.Value);
string Amount = "0";
try
{
Amount = (CnUtils.CnMethods.SelectWhere(EntryMain, InvNoCol, InvNo, DbConst.TotalValue)).ToString();
}
catch (Exception ex)
{
AppGlobal.LogGenerate(this.GetType().Name, "init", ex.ToString());
}
string number = Amount;
number = Convert.ToDouble(number).ToString();
string isNegative = "";
string AmountInWord;
if (number.Contains("-"))
{
isNegative = "Minus ";
number = number.Substring(1, number.Length - 1);
}
if (number == "0")
{
AmountInWord = "Zero Rupees";
}
else
{
AmountInWord = isNegative + ConvertToWords(number);
}
string DeclarationValue = InvoiceMaster.Instance.Declaration;
DataTable dtAmount = new DataTable();
dtAmount.Columns.Add("Word");
dtAmount.Rows.Add(AmountInWord);
DataTable Declaration = new DataTable();
Declaration.Columns.Add("Declaration");
Declaration.Rows.Add(DeclarationValue);
string abc = DbConst.Select + TbConst.CompanyMaster + DbConst.Dot + "*" + DbConst.Comma +
TbConst.SubMasterCountry + DbConst.Dot + DbConst.CountryName + DbConst.Comma +
TbConst.SubMasterState + DbConst.Dot + DbConst.StateName + DbConst.Comma +
TbConst.SubMasterState + DbConst.Dot + DbConst.StateCode +
DbConst.From + TbConst.CompanyMaster +
DbConst.InnerJoin + TbConst.SubMasterCountry + DbConst.On + TbConst.SubMasterCountry + DbConst.Dot + DbConst.CountryID + " = " + TbConst.CompanyMaster + DbConst.Dot + DbConst.CountryID +
DbConst.InnerJoin + TbConst.SubMasterState + DbConst.On + TbConst.SubMasterState + DbConst.Dot + DbConst.StateID + " = " + TbConst.CompanyMaster + DbConst.Dot + DbConst.StateID +
DbConst.Where + DbConst.CompanyID + " = " + CompnayId + ";" +
DbConst.Select + EntryMain + DbConst.Dot + InvNoCol + DbConst.Comma +
EntryMain + DbConst.Dot + DbConst.LedgerID + DbConst.Comma +
EntryMain + DbConst.Dot + DbConst.Date + DbConst.Comma +
TbConst.LedgerMaster + DbConst.Dot + DbConst.LedgerName + DbConst.Comma +
TbConst.LedgerMaster + DbConst.Dot + DbConst.GSTNumber + DbConst.Comma +
TbConst.LedgerMaster + DbConst.Dot + DbConst.PinCode + DbConst.Comma +
TbConst.LedgerMaster + DbConst.Dot + DbConst.MobileNo + DbConst.Comma +
TbConst.SubMasterCountry + DbConst.Dot + DbConst.CountryName + DbConst.Comma +
TbConst.SubMasterState + DbConst.Dot + DbConst.StateName + DbConst.Comma +
TbConst.SubMasterState + DbConst.Dot + DbConst.StateCode + DbConst.Comma +
TbConst.LedgerMaster + DbConst.Dot + DbConst.Address +
DbConst.From + EntryMain +
DbConst.InnerJoin + TbConst.LedgerMaster + DbConst.On + TbConst.LedgerMaster + DbConst.Dot + DbConst.LedgerID + " = " + EntryMain + DbConst.Dot + DbConst.LedgerID +
DbConst.InnerJoin + TbConst.SubMasterCountry + DbConst.On + TbConst.SubMasterCountry + DbConst.Dot + DbConst.CountryID + " = " + TbConst.LedgerMaster + DbConst.Dot + DbConst.CountryID +
DbConst.InnerJoin + TbConst.SubMasterState + DbConst.On + TbConst.SubMasterState + DbConst.Dot + DbConst.StateID + " = " + TbConst.LedgerMaster + DbConst.Dot + DbConst.StateID +
DbConst.Where + InvNoCol + " = '" + InvNo + "'" + " AND " + DbConst.FYearID + " = " + FYearID + "; " +
DbConst.Select + EntryMaster + DbConst.Dot + "*" + DbConst.Comma +
TbConst.ItemMaster + DbConst.Dot + DbConst.ItemName + DbConst.Comma +
TbConst.SubMasterUnit + DbConst.Dot + DbConst.UnitName +
DbConst.From + EntryMaster +
DbConst.InnerJoin + TbConst.ItemMaster + DbConst.On + TbConst.ItemMaster + DbConst.Dot + DbConst.ItemID + " = " + EntryMaster + DbConst.Dot + DbConst.ItemID +
DbConst.InnerJoin + TbConst.SubMasterUnit + DbConst.On + TbConst.SubMasterUnit + DbConst.Dot + DbConst.UnitID + " = " + EntryMaster + DbConst.Dot + DbConst.UnitID +
DbConst.Where + InvNoCol + " = '" + InvNo + "'" + " AND " + DbConst.FYearID + " = " + FYearID + "; " +
DbConst.Select + "*" + DbConst.From + SubMasterEntryDescription + DbConst.Where + InvNoCol + " = '" + InvNo + "'" + " AND " + DbConst.FYearID + " = " + FYearID + "; " +
DbConst.Select + "*" + DbConst.From + SubMasterEntryOtherDetails + DbConst.Where + InvNoCol + " = '" + InvNo + "'" + " AND " + DbConst.FYearID + " = " + FYearID + "; " +
DbConst.Select + " * " + DbConst.From + SubMasterEntryTotal + DbConst.Where + InvNoCol + " = '" + InvNo + "' AND " + DbConst.FYearID + " = " + FYearID + " ; " +
DbConst.Select + TbConst.SubMasterLedgerAddress + DbConst.Dot + " * " + DbConst.Comma +
TbConst.SubMasterCountry + DbConst.Dot + DbConst.CountryName + DbConst.Comma +
TbConst.SubMasterState + DbConst.Dot + DbConst.StateName + DbConst.Comma +
TbConst.SubMasterState + DbConst.Dot + DbConst.StateCode +
DbConst.From + TbConst.SubMasterLedgerAddress +
DbConst.InnerJoin + TbConst.SubMasterCountry + DbConst.On + TbConst.SubMasterCountry + DbConst.Dot + DbConst.CountryID + " = " + TbConst.SubMasterLedgerAddress + DbConst.Dot + DbConst.CountryID +
DbConst.InnerJoin + TbConst.SubMasterState + DbConst.On + TbConst.SubMasterState + DbConst.Dot + DbConst.StateID + " = " + TbConst.SubMasterLedgerAddress + DbConst.Dot + DbConst.StateID +
DbConst.Where + DbConst.LedgerAddressID + " = '" + LedgerAddressid + "';" +
DbConst.Select + "*" + DbConst.From + TbConst.SubMasterBankDetailsMaster + " ; " +
DbConst.Select + "*" + DbConst.From + TbConst.CompanyGSTDetails + " ; " +
DbConst.Select + SubMasterEntryOther + DbConst.Dot + "*" + DbConst.Comma +
TbConst.LedgerMaster + DbConst.Dot + DbConst.LedgerName +
DbConst.From + SubMasterEntryOther +
DbConst.InnerJoin + TbConst.LedgerMaster + DbConst.On + TbConst.LedgerMaster + DbConst.Dot + DbConst.LedgerID + " = " + SubMasterEntryOther + DbConst.Dot + DbConst.LedgerID +
DbConst.Where + InvNoCol + " = '" + InvNo + "'" + " AND " + DbConst.FYearID + " = " + FYearID;
SizeNo = Convert.ToDecimal(InvoiceMaster.Instance.No);
SizeItemName = Convert.ToDecimal(InvoiceMaster.Instance.ItemName);
SizeSize = Convert.ToDecimal(InvoiceMaster.Instance.Size);
SizePic = Convert.ToDecimal(InvoiceMaster.Instance.Pic);
SizeQuantity = Convert.ToDecimal(InvoiceMaster.Instance.Quantity);
SizeBRate = Convert.ToDecimal(InvoiceMaster.Instance.BRate);
SizeRate = Convert.ToDecimal(InvoiceMaster.Instance.Rate);
SizeValue = Convert.ToDecimal(InvoiceMaster.Instance.Value);
MarginLeftRight = Convert.ToInt32(Math.Round(Convert.ToDecimal(InvoiceMaster.Instance.MarginOfTextFromLeftAndRight) * 576));
DataSet dr = new DataSet();
dr = DbConnection.ExceuteQueryDataSet(abc);
dr.Tables.Add(dtAmount);
dr.Tables.Add(Declaration);
dr.Tables[0].TableName = TbConst.CompanyMaster;
dr.Tables[1].TableName = TbConst.SalesMain;
dr.Tables[2].TableName = TbConst.SalesMaster;
dr.Tables[3].TableName = TbConst.SubMasterSalesDescription;
dr.Tables[4].TableName = TbConst.SubMasterSalesOtherDetails;
dr.Tables[5].TableName = TbConst.SubMasterSalesTotal;
dr.Tables[6].TableName = TbConst.SubMasterLedgerAddress;
dr.Tables[7].TableName = TbConst.SubMasterBankDetailsMaster;
dr.Tables[8].TableName = TbConst.CompanyGSTDetails;
dr.Tables[9].TableName = TbConst.SubMasterSalesOther;
dr.Tables[10].TableName = "dtAmount";
dr.Tables[11].TableName = "Declaration";
temp1 = new ReportsRPT.rptInvoiceWithoutForMetal();
string path = string.Concat(Application.StartupPath, "\\ReportsRPT\\rptInvoiceWithoutForMetal.rpt");
temp1.Load(path);
temp1.SetDataSource(dr);
rptViewer.ReportSource = temp1;
decimal BoxTotal = 0;
decimal QtyTotal = 0;
string Unit = "";
for (int i = 0; i < dr.Tables[TbConst.SalesMaster].Rows.Count; i++)
{
string UnitFromReport = CnMethods.SelectWhere(TbConst.SubMasterUnit, DbConst.UnitID, dr.Tables[TbConst.SalesMaster].Rows[i][DbConst.UnitID ].ToString(), DbConst.UnitName);
if (i == 0)
{
Unit = UnitFromReport;
}
else
{
if (Unit != UnitFromReport)
{
Unit = "";
}
}
BoxTotal += Convert.ToDecimal(dr.Tables[TbConst.SalesMaster].Rows[i][DbConst.Box].ToString());
QtyTotal += Convert.ToDecimal(dr.Tables[TbConst.SalesMaster].Rows[i][DbConst.Qty].ToString());
}
(temp1.ReportDefinition.ReportObjects["tBoxTotal"] as TextObject).Text = BoxTotal.ToString();
(temp1.ReportDefinition.ReportObjects["tQtyTotal"] as TextObject).Text = QtyTotal.ToString() + " " + Unit ;
string LedgerId = dr.Tables[1].Rows[0][DbConst.LedgerID].ToString();
string LedgerTypeId = CnMethods.SelectWhere(TbConst.LedgerMaster, DbConst.LedgerID, LedgerId, DbConst.LedgerTypeID);
decimal DueBalance = Convert.ToDecimal(CnAccount.LedgerMainBalFn(Convert.ToInt32(FYearID), Convert.ToInt32(LedgerId), Convert.ToInt32(LedgerTypeId), AppSetting.Instance.FirstDateOfCompany,Convert.ToDateTime( dr.Tables[TbConst.SalesMain].Rows[0][DbConst.Date].ToString())));
decimal NetDiff = 0;
decimal NetRTGS = 0;
decimal Total = 0;
for (int i = 0; i < dr.Tables[5].Rows.Count; i++)
{
if (dr.Tables[5].Rows[i][DbConst.Title].ToString() == "NetRTGS")
{
NetRTGS = Convert.ToDecimal(dr.Tables[5].Rows[i][DbConst.TitleValue].ToString());
}
else if (dr.Tables[5].Rows[i][DbConst.Title].ToString() == "NetDiff")
{
NetDiff = Convert.ToDecimal(dr.Tables[5].Rows[i][DbConst.TitleValue].ToString());
}
else if (dr.Tables[5].Rows[i][DbConst.Title].ToString() == "Total")
{
DueBalance = DueBalance - Convert.ToDecimal(dr.Tables[5].Rows[i][DbConst.TitleValue].ToString());
}
}
decimal DueDiff = NetDiff + DueBalance;
Total = DueDiff + NetRTGS;
(temp1.ReportDefinition.ReportObjects["tOldDue"] as TextObject).Text = "Old Due : " + DueBalance;
(temp1.ReportDefinition.ReportObjects["tDueDiff"] as TextObject).Text = "Due Diff : " + DueDiff;
(temp1.ReportDefinition.ReportObjects["tRTGS"] as TextObject).Text = "RTGS : " + NetRTGS;
(temp1.ReportDefinition.ReportObjects["tTotal"] as TextObject).Text = "Total : " + Total;
(temp1.ReportDefinition.ReportObjects["Text10"] as TextObject).Text = ReportTitle;
//InvoiceNo Format
(temp1.ReportDefinition.ReportObjects["Text2"] as TextObject).Text = "No : " + InvoiceMaster.Instance.InvoiceNoBefore + InvNo + InvoiceMaster.Instance.InvoiceNoAfter;
#region ColumnSize
int OldLocation = 0;
int LineLocation = 0;
LineObject lnObj;
int fr1cm = 576;
int top;
//No
LineLocation += Convert.ToInt32(Math.Round(SizeNo * fr1cm));
lnObj = (LineObject)temp1.ReportDefinition.ReportObjects["lnNo"];
top = lnObj.Top;
lnObj.Top = lnObj.Bottom;
lnObj.Left = LineLocation;
lnObj.Right = lnObj.Left;
lnObj.Top = lnObj.Bottom;
lnObj.LineStyle = LineStyle.SingleLine;
(temp1.ReportDefinition.ReportObjects["TNo"] as TextObject).Left = MarginLeftRight;
(temp1.ReportDefinition.ReportObjects["TNo"] as TextObject).Width = LineLocation - (MarginLeftRight + OldLocation);
FieldObject GroupNameSubNo1 = (temp1.ReportDefinition.ReportObjects["GroupNameSubNo1"] as FieldObject);
GroupNameSubNo1.Left = MarginLeftRight;
GroupNameSubNo1.Width = LineLocation - (MarginLeftRight + OldLocation);
OldLocation = LineLocation;
//ItemName
LineLocation += Convert.ToInt32(Math.Round(SizeItemName * fr1cm));
lnObj = (LineObject)temp1.ReportDefinition.ReportObjects["lnItemName"];
top = lnObj.Top;
lnObj.Top = lnObj.Bottom;
lnObj.Left = LineLocation;
lnObj.Right = lnObj.Left;
lnObj.Top = lnObj.Bottom;
lnObj.LineStyle = LineStyle.SingleLine;
(temp1.ReportDefinition.ReportObjects["tItemName"] as TextObject).Left = OldLocation + MarginLeftRight;
(temp1.ReportDefinition.ReportObjects["tItemName"] as TextObject).Width = LineLocation - (MarginLeftRight + OldLocation);
FieldObject ItemName1 = (temp1.ReportDefinition.ReportObjects["ItemName1"] as FieldObject);
ItemName1.Left = OldLocation + MarginLeftRight;
ItemName1.Width = LineLocation - (MarginLeftRight + OldLocation);
FieldObject ItemDec = (temp1.ReportDefinition.ReportObjects["Description1"] as FieldObject);
ItemDec.Left = OldLocation + MarginLeftRight;
ItemDec.Width = LineLocation - (MarginLeftRight + OldLocation);
OldLocation = LineLocation;
//Size
if (InvoiceMaster.Instance.ShowSizeColumn)
{
LineLocation += Convert.ToInt32(Math.Round(SizeSize * fr1cm));
lnObj = (LineObject)temp1.ReportDefinition.ReportObjects["lnSize"];
top = lnObj.Top;
lnObj.Top = lnObj.Bottom;
lnObj.Left = LineLocation;
lnObj.Right = lnObj.Left;
lnObj.Top = lnObj.Bottom;
lnObj.LineStyle = LineStyle.SingleLine;
(temp1.ReportDefinition.ReportObjects["tSize"] as TextObject).Left = OldLocation + MarginLeftRight;
(temp1.ReportDefinition.ReportObjects["tSize"] as TextObject).Width = LineLocation - (MarginLeftRight + OldLocation);
FieldObject Size1 = (temp1.ReportDefinition.ReportObjects["Size1"] as FieldObject);
Size1.Left = OldLocation + MarginLeftRight;
Size1.Width = LineLocation - (MarginLeftRight + OldLocation);
OldLocation = LineLocation;
}
else
{
temp1.ReportDefinition.ReportObjects["lnSize"].ObjectFormat.EnableSuppress = true;
(temp1.ReportDefinition.ReportObjects["tSize"] as TextObject).ObjectFormat.EnableSuppress = true;
FieldObject Size1 = (temp1.ReportDefinition.ReportObjects["Size1"] as FieldObject);
Size1.ObjectFormat.EnableSuppress = true;
}
//Box
if (InvoiceMaster.Instance.ShowPicColumn)
{
LineLocation += Convert.ToInt32(Math.Round(SizePic * fr1cm));
lnObj = (LineObject)temp1.ReportDefinition.ReportObjects["lnPic"];
top = lnObj.Top;
lnObj.Top = lnObj.Bottom;
lnObj.Left = LineLocation;
lnObj.Right = lnObj.Left;
lnObj.Top = lnObj.Bottom;
lnObj.LineStyle = LineStyle.SingleLine;
(temp1.ReportDefinition.ReportObjects["tPic"] as TextObject).Left = OldLocation + MarginLeftRight;
(temp1.ReportDefinition.ReportObjects["tPic"] as TextObject).Width = LineLocation - (MarginLeftRight + OldLocation);
FieldObject Pic1 = (temp1.ReportDefinition.ReportObjects["Box4"] as FieldObject);
Pic1.Left = OldLocation + MarginLeftRight;
Pic1.Width = LineLocation - (MarginLeftRight + OldLocation);
OldLocation = LineLocation;
}
else
{
temp1.ReportDefinition.ReportObjects["lnPic"].ObjectFormat.EnableSuppress = true;
(temp1.ReportDefinition.ReportObjects["tPic"] as TextObject).ObjectFormat.EnableSuppress = true;
FieldObject Size1 = (temp1.ReportDefinition.ReportObjects["Box4"] as FieldObject);
Size1.ObjectFormat.EnableSuppress = true;
}
//Quantity
LineLocation += Convert.ToInt32(Math.Round(SizeQuantity * fr1cm));
lnObj = (LineObject)temp1.ReportDefinition.ReportObjects["lnQuantity"];
top = lnObj.Top;
lnObj.Top = lnObj.Bottom;
lnObj.Left = LineLocation;
lnObj.Right = lnObj.Left;
lnObj.Top = lnObj.Bottom;
lnObj.LineStyle = LineStyle.SingleLine;
(temp1.ReportDefinition.ReportObjects["tQuantity"] as TextObject).Left = OldLocation + MarginLeftRight;
(temp1.ReportDefinition.ReportObjects["tQuantity"] as TextObject).Width = LineLocation - (MarginLeftRight + OldLocation);
FieldObject Qty2 = (temp1.ReportDefinition.ReportObjects["Qty2"] as FieldObject);
Qty2.Left = OldLocation + MarginLeftRight;
Qty2.Width = LineLocation - (MarginLeftRight + OldLocation);
OldLocation = LineLocation;
**// BRate
LineLocation += Convert.ToInt32(Math.Round(SizeBRate * fr1cm));
lnObj = (LineObject)temp1.ReportDefinition.ReportObjects["lnBRate"];
top = lnObj.Top;
lnObj.Top = lnObj.Bottom;
lnObj.Left = LineLocation;
lnObj.Right = lnObj.Left;
lnObj.Top = lnObj.Bottom;
lnObj.LineStyle = LineStyle.SingleLine;
(temp1.ReportDefinition.ReportObjects["tBRate"] as TextObject).Left = OldLocation + MarginLeftRight;
(temp1.ReportDefinition.ReportObjects["tBRate"] as TextObject).Width = LineLocation - (MarginLeftRight + OldLocation);
FieldObject BRate1 = (temp1.ReportDefinition.ReportObjects["BRate1"] as FieldObject);
BRate1.Left = OldLocation + MarginLeftRight;
BRate1.Width = LineLocation - (MarginLeftRight + OldLocation);
OldLocation = LineLocation;**
//Rate
LineLocation += Convert.ToInt32(Math.Round(SizeRate * fr1cm));
lnObj = (LineObject)temp1.ReportDefinition.ReportObjects["lnRate"];
top = lnObj.Top;
lnObj.Top = lnObj.Bottom;
lnObj.Left = LineLocation;
lnObj.Right = lnObj.Left;
lnObj.Top = lnObj.Bottom;
lnObj.LineStyle = LineStyle.SingleLine;
(temp1.ReportDefinition.ReportObjects["tRate"] as TextObject).Left = OldLocation + MarginLeftRight;
(temp1.ReportDefinition.ReportObjects["tRate"] as TextObject).Width = LineLocation - (MarginLeftRight + OldLocation);
FieldObject Rate1 = (temp1.ReportDefinition.ReportObjects["Rate1"] as FieldObject);
Rate1.Left = OldLocation + MarginLeftRight;
Rate1.Width = LineLocation - (MarginLeftRight + OldLocation);
OldLocation = LineLocation;
#endregion
#region - FontColorSetting -
#region - Header Section -
BoxObject HeaderBox = (temp1.ReportDefinition.ReportObjects["Box1"] as BoxObject);
HeaderBox.FillColor = InvoiceCustomizeMaster.Instance.HeaderBoxBackColor;
#region InvoiceNoBox
BoxObject InvoiceNoBox = (temp1.ReportDefinition.ReportObjects["Box2"] as BoxObject);
InvoiceNoBox.FillColor = InvoiceCustomizeMaster.Instance.InvoiceNoBoxBackColor;
TextObject InvoiceBox1 = (temp1.ReportDefinition.ReportObjects["Text1"] as TextObject);
InvoiceBox1.Color = InvoiceCustomizeMaster.Instance.InvoiceNoBoxFontColor;
InvoiceBox1.ApplyFont(InvoiceCustomizeMaster.Instance.InvoiceNoBoxFont);
TextObject InvoiceBox2 = (temp1.ReportDefinition.ReportObjects["Text2"] as TextObject);
InvoiceBox2.Color = InvoiceCustomizeMaster.Instance.InvoiceNoBoxFontColor;
InvoiceBox2.ApplyFont(InvoiceCustomizeMaster.Instance.InvoiceNoBoxFont);
#endregion
#region CustomerName
FieldObject CustomerName = (temp1.ReportDefinition.ReportObjects["LedgerName1"] as FieldObject);
CustomerName.Color = InvoiceCustomizeMaster.Instance.CustomerNameFontColor;
CustomerName.ApplyFont(InvoiceCustomizeMaster.Instance.CustomerNameFont);
#endregion
#region CustomerOtherDetails
FieldObject CustomerOtherDetails = (temp1.Subreports["OtherDetails"].ReportDefinition.ReportObjects["Title1"] as FieldObject);
CustomerOtherDetails.Color = InvoiceCustomizeMaster.Instance.CustomerOtherDetailsFontColor;
CustomerOtherDetails.ApplyFont(InvoiceCustomizeMaster.Instance.CustomerOtherDetailsFont);
FieldObject CustomerOtherDetails1 = (temp1.Subreports["OtherDetails"].ReportDefinition.ReportObjects["Title11"] as FieldObject);
CustomerOtherDetails1.Color = InvoiceCustomizeMaster.Instance.CustomerOtherDetailsFontColor;
CustomerOtherDetails1.ApplyFont(InvoiceCustomizeMaster.Instance.CustomerOtherDetailsFont);
#endregion
#endregion
#region - Details Section -
#region ItemBox
BoxObject ItemBox = (temp1.ReportDefinition.ReportObjects["Box3"] as BoxObject);
ItemBox.FillColor = InvoiceCustomizeMaster.Instance.ItemBoxBackColor;
TextObject ItemBox3 = (temp1.ReportDefinition.ReportObjects["tNo"] as TextObject);
ItemBox3.Color = InvoiceCustomizeMaster.Instance.ItemBoxFontColor;
ItemBox3.ApplyFont(InvoiceCustomizeMaster.Instance.ItemBoxFont);
TextObject ItemBox12 = (temp1.ReportDefinition.ReportObjects["tItemName"] as TextObject);
ItemBox12.Color = InvoiceCustomizeMaster.Instance.ItemBoxFontColor;
ItemBox12.ApplyFont(InvoiceCustomizeMaster.Instance.ItemBoxFont);
TextObject ItemBox4 = (temp1.ReportDefinition.ReportObjects["tSize"] as TextObject);
ItemBox4.Color = InvoiceCustomizeMaster.Instance.ItemBoxFontColor;
ItemBox4.ApplyFont(InvoiceCustomizeMaster.Instance.ItemBoxFont);
TextObject ItemBox5 = (temp1.ReportDefinition.ReportObjects["tPic"] as TextObject);
ItemBox5.Color = InvoiceCustomizeMaster.Instance.ItemBoxFontColor;
ItemBox5.ApplyFont(InvoiceCustomizeMaster.Instance.ItemBoxFont);
TextObject ItemBox6 = (temp1.ReportDefinition.ReportObjects["tQuantity"] as TextObject);
ItemBox6.Color = InvoiceCustomizeMaster.Instance.ItemBoxFontColor;
ItemBox6.ApplyFont(InvoiceCustomizeMaster.Instance.ItemBoxFont);
TextObject ItemBox7 = (temp1.ReportDefinition.ReportObjects["tRate"] as TextObject);
ItemBox7.Color = InvoiceCustomizeMaster.Instance.ItemBoxFontColor;
ItemBox7.ApplyFont(InvoiceCustomizeMaster.Instance.ItemBoxFont);
TextObject ItemBox8 = (temp1.ReportDefinition.ReportObjects["tValue"] as TextObject);
ItemBox8.Color = InvoiceCustomizeMaster.Instance.ItemBoxFontColor;
ItemBox8.ApplyFont(InvoiceCustomizeMaster.Instance.ItemBoxFont);
#endregion
this.rptViewer.RefreshReport();
//temp1.Dispose();
}
Когда я комментирую код местоположения столбца BRate, тогда он работает нормально. ![enter image description here](https://i.stack.imgur.com/8xexs.png)
Одна вещь, которую я отмечаю, в предварительном просмотре печати, у меня есть красная метка - Нет: а в режиме дизайна оснастки есть BillNo. У меня есть чек Run-> Temp и Run ->% Temp%
Некоторый код, который я удалил из-за превышения лимита.