none
Validate if blank document RRS feed

  • Question

  • Hello experts,

    I am currently developing and app for office 2013. There is a current requirement of this project for validating if the current document is a new document (if the user has not added content) or if the user is currently working on the document (if the suer has added content).

    I am able to use the getFileAsync(fileType [, options], callback) method with the fileType as "text", however if the user has added any images this will not revele me that infomration. 

    Hence I would like to know if there is a tweak that I could utilize to satisfy this basic requirement.

    Thanks and Regards,

    Praneeth


    Thursday, June 11, 2015 4:59 AM

Answers

  • ​Hi Praneeth,

    >> if it will be vaid for me to measure the number of bytes in order to determine if the document is a blank document, which may cause issues if there are minute changes in the OOXML based on office versions or plugins.

    In my option, the OOXML would be different based on Office versions, it would be not related with plugins. So if you use different Office versions, it might be wrong. But as far as I know, apps for Office support Office 2013 and later, I am not sure whether you used in versions of Office 2013 later.

    With GetFileAsync method, as you know, the Office.FileType.Text would only return text, I tried my best to find other way to achieve your requirement, but there is no result at present.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, June 16, 2015 9:46 AM

All replies

  • ​Hi Praneeth,

    >> I am able to use the getFileAsync(fileType [, options], callback) method with the fileType as "text", however if the user has added any images this will not revele me that infomration.

    What's the information you need from the file? The Office.FileType.Text (text) returns only the text of the document as a string, if you want to detect the images, I suggest you use Office.FileType.Compressed (compressed). But compressed returns the entire document (.pptx or .docx) in Office Open XML format as a byte array.

    You could refer the link below for more information.

    # Document.getFileAsync method (JavaScript API for Office)

    https://msdn.microsoft.com/en-us/library/office/jj715284.aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, June 12, 2015 10:13 AM
  • Hi Edward,

    Many thanks for your reply. I believe my question was not clear and I will try to provide more detail related to the current requirement I have.

    The requirement is that I need to validate if the word document is in a "New" state where the user has not made any change to the document by adding content, where content can be of types text, images, objects, graphs, etc. 

    I can verify this to a cirtain extent if I use the GetFileAsync() with the user of Office.FileType.Text. However if the user has added any images or other content that cannot be represented in string this approach will not work.

    Hence as suggessted by you i could use the Office.FileType.Compressed option, however my concern is if it will be vaid for me to measure the number of bytes in order to determine if the document is a blank document, which may cause issues if there are minute changes in the OOXML based on office versions or plugins.

    Any help would be much appricated and thanks in advance.

    Regards,

    Praneeth


    Monday, June 15, 2015 10:58 AM
  • ​Hi Praneeth,

    >> if it will be vaid for me to measure the number of bytes in order to determine if the document is a blank document, which may cause issues if there are minute changes in the OOXML based on office versions or plugins.

    In my option, the OOXML would be different based on Office versions, it would be not related with plugins. So if you use different Office versions, it might be wrong. But as far as I know, apps for Office support Office 2013 and later, I am not sure whether you used in versions of Office 2013 later.

    With GetFileAsync method, as you know, the Office.FileType.Text would only return text, I tried my best to find other way to achieve your requirement, but there is no result at present.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, June 16, 2015 9:46 AM