Access source segments

Hi,

I created a project in Studio and would like to access all source segments for the files in that project. What would be the easiest way?

I tried this:

FileBasedProject currFbp = new FileBasedProject(filepath);
projectsController.Open(currFbp);
var projectFiles = projectsController.CurrentProject.GetSourceLanguageFiles();
foreach (var projectFile in projectFiles)
{
    var editorController = SdlTradosStudio.Application.GetController<EditorController>();
    editorController.Activate();
    editorController.Open(projectFile);
}

It now opens the editor and I can access all segments. However, before it opens a file, I get a dialog.

I then tried to open all files:


FileBasedProject currFbp = new FileBasedProject(filepath);
projectsController.Open(currFbp);
var projectFiles = projectsController.CurrentProject.GetSourceLanguageFiles();
var editorController = SdlTradosStudio.Application.GetController<EditorController>();
editorController.Activate();
editorController.Open(projectFiles, EditingMode.Review);

However, now I get an exception: "An exception of type 'System.InvalidOperationException' occurred in Sdl.TranslationStudioAutomation.IntegrationApi.dll but was not handled in user code

Additional information: The file xyz.docx.sdlxliff belongs to a project that is not currently open. Open the project first."

Thanks,

Henk

Parents Reply Children
No Data