How to close the active sdlxliff file opened in the Editor

Hello.

I'm trying to learn the features available in the Integration API.
The first thing that I'm trying is to close the active sdlxliff file opened in the Editor.

I've created a C# project with a form containing one button.

I've added the following references:

Sdl.Desktop.IntegrationApi
Sdl.Desktop.IntegrationApi.Extensions
Sdl.TranslationStudioAutomation.IntegrationApi

Below is the code written in Form1.cs.

When I run this code, nothing happens (the active file does not close).
What am I missing here?

Thank you in advance.

Tak Osato


====================================================
using System;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
using System.Net.NetworkInformation;
using System.Globalization;
using System.Threading;
using System.ComponentModel;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sdl.Desktop.IntegrationApi;
using Sdl.Desktop.IntegrationApi.Extensions;
using Sdl.TranslationStudioAutomation.IntegrationApi;


namespace Trados_SDK_test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {

            EditorController myEditor = new EditorController();
                       

            Document myDoc;

            
            myDoc = myEditor.ActiveDocument;

            myEditor.Close(myDoc);



        }
    }
}

===========================================

Parents Reply Children
  • Hi Patrick

    Thanks for your reply, the reason why I need to distinguish whether the verification was launched using a batch or in the editor is because in French language, there are some F & R that need to be made, for example, replacing straight apostrophes by curly ones, replace a normal space by a non-breaking space before currency, etc.

    If the verification is launched using a batch action, Studio would save the changes and reopen files in the editor, but if launched by pressing F8, then I need to add one step of saving the file currently open in editor.

    If the feature of taking control of the editor is not available, then I will look for an alternative.

    Thanks