Beispiel #1
0
        private void autoOpen(Stream stream)
        {
            string addinGuid    = ConfigurationManager.AppSettings["owa:Id"];
            string addinVersion = ConfigurationManager.AppSettings["owa:Version"];

            using (var document = WordprocessingDocument.Open(stream, true))
            {
                var webExTaskpanesPart = document.AddWebExTaskpanesPart();
                OOXMLHelper.CreateWebExTaskpanesPart(webExTaskpanesPart, addinGuid, addinVersion);
            }
        }
Beispiel #2
0
        private void autoOpen(string path)
        {
            string addinGuid    = ConfigurationManager.AppSettings["owa:Id"];
            string addinVersion = ConfigurationManager.AppSettings["owa:Version"];

            using (var document = WordprocessingDocument.Open(path, true))
            {
                var webExTaskpanesPart = document.WebExTaskpanesPart ?? document.AddWebExTaskpanesPart();
                foreach (var part in webExTaskpanesPart.Parts)
                {
                    if (part.RelationshipId == "rId1")
                    {
                        return;
                    }
                }
                OOXMLHelper.CreateWebExTaskpanesPart(webExTaskpanesPart, addinGuid, addinVersion);

                document.Close();
            }
        }