Free Support Forum -

Section.CompleteClone() problem

Hi again,

while using the latest version of the dll, the completeClone() of the Section Object throws an ugly exception. We have a possible workaround, but we are currently in a bit of a hurry, so if you can help - would be great.


Zeile 88: ((Text)pdf1.GetObjectByID(“Referenz”)).Segments.Add(zei.Referenz);
Zeile 89:
Zeile 90: Section sec1 = (Section)pdf1.Sections[0].CompleteClone();
Zeile 91: pdf2.Sections.Add(sec1);
Zeile 92: }

Quelldatei: c:\inetpub\wwwroot\uap\code\data\pdfcreator.cs Zeile: 90


[NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.]
Aspose.Pdf.Cells.Add(Cell cell)
Aspose.Pdf.Section.CompleteClone() emissionId, String path) in c:\inetpub\wwwroot\uap\code\data\pdfcreator.cs:90
uap.ed.EmiOverview.btnAvis_Click(Object sender, ImageClickEventArgs e) in c:\inetpub\wwwroot\uap\ed\emioverview.aspx.cs:119
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

The following XML is used as template:

<?xml version="1.0" encoding="iso8859-1" ?>

<Table ColumnWidths=“200 100 100” MarginTop=“20” MarginBottom=“20” DefaultCellPaddingTop=“3”
DefaultCellPaddingBottom=“3” DefaultCellPaddingLeft=“5” DefaultCellPaddingRight=“5”>


<Table ColumnWidths=“120 90 90 100” MarginTop=“20” MarginBottom=“20” DefaultCellPaddingTop=“3”
DefaultCellPaddingBottom=“3” DefaultCellPaddingLeft=“5” DefaultCellPaddingRight=“5”>




Dear Timo,

Thank you for considering Aspose.

I have tested binding your template XML and then CompleteCloning the first section and get no exception. Would you please post the complete code in pdfcreator.cs to let me have a test?


public string createDA(long emissionId, string path, string user, Page p)
Pdf.SetLicense(path + “/bin/Aspose.Pdf.lic”, p);

Emission emission = DBAccess.getDBAccess().readEmission(emissionId);
Emittent emittent = DBAccess.getDBAccess().readEmittent(emission.EmittentID);
ArrayList arlzei = DBAccess.getDBAccess().processZeichnungen(emissionId, 5, 901);
Pdf pdf2 = new Pdf();
pdf2.PageSetup.PageHeight = PageSize.A4Height;
Zeichnung zei;

for (int i = 0; i < arlzei.Count; i++)
Pdf pdf1 = new Pdf();
pdf1.PageSetup.PageHeight = PageSize.A4Height;
pdf1.BindXML(path + “/ed/~” + emittent.ID + “/DA.xml”, null);

zei = (Zeichnung)arlzei[i];
((Image)pdf1.GetObjectByID(“IMG1”)).ImageInfo.File = path + “/kd/~” + emittent.ID + “/logo.gif”;
((Segment)pdf1.GetObjectByID(“KundeName”)).Content = zei.PreName + " " + zei.SureName;
((Segment)pdf1.GetObjectByID(“ErstellungOrt”)).Content = zei.City + ", ";
((Segment)pdf1.GetObjectByID(“ErstellungDatum”)).Content = DateTime.Today.ToString();
((Segment)pdf1.GetObjectByID(“KundeStrasse”)).Content = zei.Street;
((Segment)pdf1.GetObjectByID(“KundeDepotnr”)).Content = zei.DepotKonto;
((Segment)pdf1.GetObjectByID(“KundeOrt”)).Content = zei.City;
((Segment)pdf1.GetObjectByID(“amGEDatum”)).Content = "am " + zei.GEDatum.ToShortDateString();
((Segment)pdf1.GetObjectByID(“Referenz”)).Content = zei.Referenz;

//Section sec1 = (Section)pdf1.Sections[0].CompleteClone();
DBAccess.getDBAccess().updateZeichnungsStatus(zei.ZID, 5, 901, user);

string outName = “~” + DateTime.Now.Ticks + “.pdf”;
string outFile = path + “/tmp/~” + DateTime.Now.Ticks + “.pdf”;
return outName;

I hope you can get something out of my german code :slight_smile:

Dear Timo,

Thank you for considering Aspose.

Sorry,I still can’t get the error. Would you please give me a runable code without database connection which can reproduce this error?