在Git中配置PowerPoint比较和合并(&A) [英] Configure PowerPoint Compare & Merge in git

查看:24
本文介绍了在Git中配置PowerPoint比较和合并(&A)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PowerPoint具有在UI中比较2个PowerPoint文件的功能。它位于审阅功能区中,然后比较

我要将Git配置为能够从命令行比较&;合并2个PowerPoint文件,弹出打开PowerPoint,解决更改并保存。

但不幸的是,如果没有多次点击,我似乎找不到在比较模式下打开PowerPoint的方法。有人碰巧知道调用powerpnt.exe以在此魔术模式下打开的正确方法吗?

推荐答案

经过充分研究后得出的结论是,虽然Powerpoint确实支持合并模式,但无法使用命令行参数在该模式下打开它。

但合并文档的API在COM对象模型中可用,因此也可以通过主互操作程序集从.NET获得。

我最终编写了一个小型开放源码项目,它充当命令行和PowerPoint之间的代理来启动和合并文件。(目前仍在进行中,粗制滥造):

https://github.com/jessehouwing/ppt-diffmerge

ppt-diffmerge-tool --local="$LOCAL" --remote="$REMOTE" --base="$BASE" --output="$RESULT" 

核心代码:


PowerPointApplication app = null;
Presentation presentation = null;

try
{
    app = new PowerPointApplication();
    app.PresentationCloseFinal += App_PresentationClose;

    if (!string.IsNullOrWhiteSpace(Output))
    {
        File.Copy(Local, Output, true);
        Local = Output;
    }

    presentation = app.Presentations.Open(Local);

    if (string.IsNullOrWhiteSpace(Base))
    {
        presentation.Merge(Remote);
    }
    else
    {
        presentation.MergeWithBaseline(Remote, Base);
    }

    handle.WaitOne();
}
finally
{
    Marshal.ReleaseComObject(presentation);
    Marshal.ReleaseComObject(app);
}
return 0;

太疯狂了,甚至支持三向合并!

这篇关于在Git中配置PowerPoint比较和合并(&A)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆