The late Princess Diana leaked a royal phone directory to the now defunct News of the World tabloid, its former royal editor told Britain's phone-hacking trial on Thursday.

Clive Goodman said that Diana sent him the information by post in 1992, the year she separated from her husband Prince Charles, the heir to the throne.

"She was going through a very, very difficult time. She told me she wanted me to see the scale of her husband's staff and household, compared with others," Goodman told London's Old Bailey, where he is on trial.

"She felt she was being swamped by people close to his household. She was looking for an ally to take him on -- to show there were forces that would rage against him."

Goodman is on trial for two counts of conspiring to commit misconduct in a public office, namely paying public officials for a royal phone directory, which he denies.

The 56-year-old was jailed in 2007 for hacking into the phones of members of the royal household, along with private investigator Glenn Mulcaire.

Goodman told the court that he used so-called Green Books and internal telephone directories containing contact numbers for royal staff and senior members of the household as a basis for his stories.

Asked by his defence lawyer how he received them, he denied paying for them and said one green book was given to him in 1992 by Diana.

"That arrived at my office in Wapping with my name on it. She had a (good) relationship with several journalists -- Richard Kay at the Daily Mail, Martin Bashir of Panorama," Goodman told the court.

Three years later in 1995 Diana would open up to Bashir, a journalist with the BBC, about the state of her marriage to Charles, in an explosive interview that ultimately led to their divorce the following year.

Diana, the mother of Princes William and Harry, was killed in a car crash in Paris in 1997.

Goodman was sacked from the News of the World after his conviction and it later emerged that the practice of phone hacking was widespread at the Rupert Murdoch-owned tabloid.

Murdoch shut down the Sunday paper in July 2011 after reports that one of the hacking victims was a missing schoolgirl, Milly Dowler, who was later found murdered.