Free Support Forum - aspose.com

Smart Cut and Paste

Word has an option called “Smart Cut and Paste”, which by default is set on. It automatically removes extra spaces when, for instance, you delete a single word in a line of text. Does Aspose have something that is comparable to this?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your interest in Aspose.Words. There is no such functionality. Could you please explain how you plan to use this option programmatically? In Word documents text data are represented as set of Runs. In Aspose.Words you can work with Runs, so when you would like to edit some text, you work with simple strings within Run or few Runs. Please see Aspose.Words DOM:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/object-model-overview.html

So it is not clear for me how you can use this option in Aspose.Words.

Best regards.

We have programmatic editing (including text deletion) in our existing Word application. It takes advantage of smart cut/paste so we don’t have to have additional coding to look for consecutive spaces after the text deletion.

I know I can code for it in the Aspose application, but thought I would first ask just in case you had something.

On a unrelated note, we have documents with more than one bookmark at the same location. In Aspose, the nodes look like:

BMStart:FiledHerewith
BMStart:Domestic
BMEnd:FiledHerewith
BMEnd:Domestic

Not a problem, but I would have expected:

BMStart:FiledHerewith
BMEnd:FiledHerewith
BMStart:Domestic

BMEnd:Domestic

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Could you please attach sample document here for testing? I will check the issue with bookmarks and provide you more information.

Best regards.

This is not a problem for me, it just seemed a little odd. Here’s a sample document. It was prebuilt with Word. Look for this sequence of nodes:

BMStart:FiledHerewithEnd
BMStart:DomesticEnd
BMEnd:FiledHerewithEnd
BMEnd:DomesticEnd

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I understand this is not a problem. I just investigated the issue and I can say that MS Word really writes these nodes in such order. You can save your document for example in DOCX and open document.xml to see this. Here is part of the XML:

</w:r>

<w:bookmarkStart w:id="13" w:name="FiledHerewithEnd" />

<w:bookmarkStart w:id="14" w:name="DomesticEnd" />

<w:bookmarkEnd w:id="13" />

<w:bookmarkEnd w:id="14" />

<w:r>

Best regards.