I’m currently using Aspose.Words 9.7.0 and looking for a way to (temporary) hide a shape. I did some searching and I found that the Aspose.Cells Shape object has an IsHidden property. However, I’m unable to find the Aspose.Words equivalent. Does is exist?
Hi
Thanks for your request. You can achieve using code like the following:
// Open document.
Document doc = new Document(@"Test001\in.doc");
// Get collection of shapes.
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
foreach(Shape shape in shapes)
{
// get shape make it hidden.
shape.Font.Hidden = true;
}
// Save output.
doc.Save(@"Test001\out.doc");
The document contain several floating images (body, header, footer) and also an inline shape in the body. None of the images are hidden in the result document.
Hello,
Thank you for additional information.
Unfortunately, I could not reproduce the problem on my side. I’m using exactly the same code as you, but in my output document all the pictures are invisible. But the picture itself in the document are present, this can be easily ascertained using Document Explorer (C:\Program Files\Aspose\Aspose.Words for. NET\Demos\CSharp\DocumentExplorer)
Please tell me what version of MS Office you are using?
That’s strange. I’m using Office 2010 on my dev machine. I also tested it by opening the created document in Office 2003 and Office 2007 and it gives the same result. Saving the document as docx doesn’t seem to help also. I’ve attached the created document to this post.
Thank you for additional information. Tell me how you would like to document looks like after the image will be “invisible”. I mean, they would have simply disappeared from the document and moved the text? Or do they remain in place, but were, for example, white?
If the second suit, you can change the brightness of images.
shape.ImageData.Brightness = 1;
to return to the previous brightness, set it equal to 0.5.
Still describe how you see the disappearance of images. I will try to help.
Hi
Thanks for your request. You do see the hidden images because “Display hidden text” option is enabled in MS Word. Disable this option and you will not see the hidden content. Please see the attached screenshot.
Best regards,
Hi
Thank you for additional information. Unfortunately, there is no public API to set this property using Aspose.Words. I logged your request in our defect database. We will let you know once this property is available in public API.
Best regards,
Thanks for your inquiry. I am afraid the requested feature is still not implemented due to other priority tasks. Moreover, the demand of this feature is very low so its implementation is not planned yet. However, we will notify you as soon as we made some significant progress towards its implementation.