I want to apply lock tracking way
Aspose.Words.Document asposeDocument = new Aspose.Words.Document(memoryStream)
{
TrackRevisions = true
};
this is the normal way for it…I want to know the way to apply lock tracking\
I want to apply lock tracking way
Aspose.Words.Document asposeDocument = new Aspose.Words.Document(memoryStream)
{
TrackRevisions = true
};
this is the normal way for it…I want to know the way to apply lock tracking\
To apply lock tracking in a Word document using Aspose.Words, you can utilize the StartTrackRevisions
method to enable revision tracking. However, to implement lock tracking specifically, you would typically need to manage the document’s revision tracking state carefully.
Here’s a general approach to achieve this:
Aspose.Words.Document
class.StartTrackRevisions
method to begin tracking changes.StopTrackRevisions
method to stop tracking.Here is a code example demonstrating these steps:
using Aspose.Words;
// Load the document
Aspose.Words.Document asposeDocument = new Aspose.Words.Document(memoryStream);
// Start tracking revisions
asposeDocument.StartTrackRevisions("Author Name");
// Make your changes here
// For example, adding a paragraph
DocumentBuilder builder = new DocumentBuilder(asposeDocument);
builder.Writeln("This is a new paragraph.");
// Stop tracking revisions
asposeDocument.StopTrackRevisions();
// Save the document
asposeDocument.Save("output.docx");
This code snippet initializes a document, starts tracking revisions, makes a change by adding a new paragraph, and then stops tracking before saving the document.
If you are looking for a specific implementation of lock tracking (where changes are restricted to certain users or conditions), you may need to implement additional logic to manage user permissions and document states, as Aspose.Words does not provide built-in lock tracking functionality directly.
For more detailed information on working with revisions in Aspose.Words, you can refer to the official documentation.
If you have further questions or need more specific examples, feel free to ask!
@Rubal Unfortunately, it is not quite clear what you mean. Could you please elaborate your requirements in more details? If possible, please, provide input and expected output documents or a screenshot of what you are trying to achieve.
I have a document which is of aspose… Now what i do is
Aspose.Words.Document asposeDocument = new Aspose.Words.Document(memoryStream)
{
TrackRevisions = true
};
apply this and send to users… Now users can go and disable it …which I don’t want…
i want to lock the track changes so that nobody can disable it
I want to apply lock tracking. so that no body can go and disable track changes
New Microsoft Word Document.docx (13.0 KB)
i HAVE APPLIED LOCK TRACKING IN IT… YOU CAN’T DIASBLE TRACK CHANGES
@Rubal Thank you for additional information. Your document is simply protected with AllowOnlyRevisions
protection type. So as it was suggested earlier you simply need to protect your document with ProtectionType.AllowOnlyRevisions
.
Document doc = new Document(@"C:\Temp\in.docx");
doc.TrackRevisions = true;
doc.Protect(ProtectionType.AllowOnlyRevisions, "pass");
doc.Save(@"C:\Temp\out.docx");
the way to unlock it?
@Rubal You can simply unprotect the document:
Document doc = new Document(@"C:\Temp\in.docx");
doc.Unprotect();
doc.Save(@"C:\Temp\out.docx");
this is locking my file to edit which i don’t want… I only want to apply lock tracking so that no body can go and play with track changes…
@Rubal The document produce by the above code has the same track changes settings as the document you have attached.
with the above code it is making my document in read only mode…i only want track changes to get locked not the document
@Rubal Here is output produced on my side:
in.docx (12.6 KB)
out.docx (10.1 KB)
The output document can be edited.
@Rubal Are you able to open the document you have uploaded earlier? As I can see both documents have same protection settings.
Your document:
<w:documentProtection w:edit="trackedChanges" w:enforcement="1" w:cryptProviderType="rsaAES" w:cryptAlgorithmClass="hash" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmSid="14" w:cryptSpinCount="100000" w:hash="GVbSjItMwgopE1POQyB0qTTGy4pgp81JR6YqtiyIh52ykKctJqHPGV3kchiKpD/TSRVErZuRWJTzFYDLYI9FUQ==" w:salt="k1C+7U6zjassh76kbbyoZA=="/>
Document generated by Aspose.Words:
<w:documentProtection w:edit="trackedChanges" w:enforcement="1" w:cryptProviderType="rsaFull" w:cryptAlgorithmClass="hash" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmSid="4" w:cryptSpinCount="50000" w:hash="PnPyoslFy+Rq9AgqXk/bKgQkwJE=
" w:salt="hIqOl99kIr/+N0hyovEq7Q==
" />
no but the document which I am getting is non editabler…i want to lock only track changes… so that no user can go and make this off
@Rubal Unfortunately, I cannot reproduce the problem on my side. As I have mentioned the document produced by Aspose.Words has the same protection options as the document you have attached above. The document works fine in MS Word 2019.