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

Free Support Forum - aspose.cloud

PHP API: previous insertBookmark code not working anymore

The code below is not longer working since the last update:
Error: InsertBookmark. Exception: Object reference not set to an instance of an object..

            new InsertBookmarkRequest(
                new BookmarkInsert([
                    "start_range"   => new DocumentPosition([
                                                "node"      => new NodeLink(["node_id" => ""]),
                                                "offset"    => 0
                    "end_range"     => new DocumentPosition([
                                                "node"      => new NodeLink(["node_id" => ""]),
                                                "offset"    => 0,
                    "name"          => "bookmark-test",
                    "text"          => "TEST!"

I can get testInsertBookmarkOnline from the test cases to work without erroring - but I can’t see why I cannot insert a bookmark using the code above with the attached document:

mydoc.docx (13.6 KB)


I am unable to notice any issue with my sample code with your attached document. However, I am looking into your code, WORDSCLOUD-2346, to find the root cause of the problem.

$requestBookmarkStartRange = new Aspose\Words\Model\NewDocumentPosition(array(
    	    "node_id" => "",
            "offset" => 0,));
	$requestBookmarkEndRange = new Aspose\Words\Model\NewDocumentPosition(array(
	    "node_id" => "",
	    "offset" => 0,));
	$requestBookmark = new Aspose\Words\Model\BookmarkInsert(array(
	    "start_range" => $requestBookmarkStartRange,
	    "end_range" => $requestBookmarkEndRange,
	    "name" => "new_bookmark",
	    "text" => "Some text",));
	$insertRequest = new Aspose\Words\Model\Requests\InsertBookmarkRequest(
	$result = $wordsApi->insertBookmark($insertRequest);