Cannot delete last empty paragraph

H

Holy

When I open an existing document, word add empty paragraph at the end of it,
I want to delete it but it doesn't work.

Range rangeDeleted = m_WordDocument.Paragraphs.Last.Range;
Object type = WdUnits.wdCharacter;
Object unit = rangeDeleted.Text.Length;
int delItem = rangeDeleted.Delete(ref type, ref unit);

delItem equals 0, but i dont know why, and my paragraph still there.
Any sugestion?
 
D

Doug Robbins - Word MVP on news.microsoft.com

You cannot delete the last paragraph mark in a document, but you can delete
the one before it.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top