Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing Microsoft Word documents #18

Open
siwix opened this issue Jan 14, 2016 · 5 comments
Open

Editing Microsoft Word documents #18

siwix opened this issue Jan 14, 2016 · 5 comments

Comments

@siwix
Copy link

siwix commented Jan 14, 2016

I'm trying to understand the webdav server, but I'm unable to edit Office documents.
In MS Word I open a document using http://localhost:4568/doctest.docx as filename. The document opens fine in protected read only mode. I click on enable editing and the protected mode disappears, but the document is still in read only mode.

I'm using the Development build where locking is implemented.
Also, if I map the http location to a Network drive I can edit documents.

Any ideas?

@akotousov
Copy link

I have the exact same problem when using Word 2013 (although everything works fine with Word 2010). Any ideas to get it working for Word 2013 would be very helpful.

@bwakabats
Copy link

Same problem with Word 2016

@dh-phuong
Copy link

dh-phuong commented Apr 5, 2017

Yes. Same problem with Word 2016

    public Stream OpenWriteStream(bool append)
    {
        if (append)
        {
            FileStream result = new FileStream(ItemPath, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
            result.Seek(0, SeekOrigin.End);
            return result;
        }

        Stream stream = null;
        try
        {
            // Impersonate the current user and create the file stream for writing the file
            WindowsImpersonationContext wic = Identity.Impersonate();
            stream = new FileStream(ItemPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
            wic.Undo();
        }
        catch(Exception ex)
        {
            throw ex; // File access denied
        }
        return stream;
    }

@Nikesh-Newaskar
Copy link

Any updates on the Editing document in Word?. I am also facing the same issue where the document is opening in read-only mode in Word 2016

@fabricecaruso
Copy link

It's caused by a wrong mime type in WebDavHeadMethodHandler.cs

It can be fixed by replacing :
context.Response.AppendHeader("Content-Type", "text/html");
with
context.Response.AppendHeader("Content-Type", MimeMapping.GetMimeMapping(doc.Name));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants