We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

GetObjectById not working?

I’m trying to get an object to update it’s value by doc.GetObjectById It’s working for the first table only but it’s always return null if I use another table

@alterawiwork

Could you kindly share the sample XML file along with complete code snippet that you are using. We will test the scenairo in our environment and address it accordingly.

TheXMLCode.zip (1.6 KB)

the C# code is

      var dataDir = @"C:\Users\OGhani\Downloads\";

        string inXml = dataDir + "input2.xml";
        string inFile = dataDir + "0.png";
        string outFile = dataDir + "output_out.pdf";
        Document doc = new Document();
        doc.BindXml(inXml);
        //Aspose.Pdf.Image image = (Aspose.Pdf.Image)doc.GetObjectById("testImg");
        //TextSegment text = (TextSegment)doc.GetObjectById("omarSegment");
        var assignedToUser = (TextSegment)doc.GetObjectById("AssignedToUser");
        assignedToUser.Text = "omar test";
        //image.File = inFile;
        doc.Save(outFile);

@alterawiwork

We believe that your inquiry is similar to this thread. We have responded there so you can follow it up as well.