/// <summary> /// Updates the settings that user selected /// </summary> /// <param name="settings"></param> public void UpdateSettings(GeneratorSettings settings) { _settings = settings; _settings.DontExportContext = cb_DontExportContext.Checked; _settings.DontExportExact = cb_DontExportExact.Checked; _settings.DontExportFuzzy = cb_DontExportFuzzy.Checked; _settings.DontExportNoMatch = cb_DontExportNoMatch.Checked; _settings.ExcludedStatuses.Clear(); foreach (SegmentStatus item in cbl_ExcludedStatuses.CheckedItems) { _settings.ExcludedStatuses.Add(item.Status); } if (rb_ExcludeStatus.Checked) { _settings.ExcludeExportType = GeneratorSettings.ExclusionType.Status; } if (rb_ExcludeCategory.Checked) { _settings.ExcludeExportType = GeneratorSettings.ExclusionType.Category; } if (excludeLockedBtn.Checked) { _settings.ExcludeExportType = GeneratorSettings.ExclusionType.Locked; } }
/// <summary> /// Updates the Ui after user set the changes /// </summary> /// <param name="settings"></param> public void UpdateUI(GeneratorSettings settings) { _settings = settings; switch (_settings.ExcludeExportType) { case GeneratorSettings.ExclusionType.Category: rb_ExcludeCategory.Checked = true; break; case GeneratorSettings.ExclusionType.Status: rb_ExcludeStatus.Checked = true; break; default: break; } cbl_ExcludedStatuses.Items.Clear(); AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.ApprovedSignOff)); AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.ApprovedTranslation)); AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.Draft)); AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.RejectedSignOff)); AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.RejectedTranslation)); AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.Translated)); AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.Unspecified)); cb_DontExportContext.Checked = _settings.DontExportContext; cb_DontExportExact.Checked = _settings.DontExportExact; cb_DontExportFuzzy.Checked = _settings.DontExportFuzzy; cb_DontExportNoMatch.Checked = _settings.DontExportNoMatch; }
/// <summary> /// Calls Automatic task method for data binding /// </summary> /// <param name="settings"></param> public void SetSettings(GeneratorSettings settings) { _settings = settings; SettingsBinder.DataBindSetting <string>(tb_Prefix, "Text", _settings, nameof(_settings.FileNamePrefix)); SettingsBinder.DataBindSetting <decimal>(n_ColumnWidth, "Value", _settings, nameof(_settings.ColumnWidth)); SettingsBinder.DataBindSetting <bool>(cb_ExtractComments, "Checked", _settings, nameof(_settings.ExtractComments)); }
/// <summary> /// Calls Automatic task method for data binding /// </summary> /// <param name="settings"></param> public void SetSettings(GeneratorSettings settings) { _settings = settings; SettingsBinder.DataBindSetting<string>(tb_Prefix, "Text", _settings, nameof(_settings.FileNamePrefix)); SettingsBinder.DataBindSetting<decimal>(n_ColumnWidth, "Value", _settings, nameof(_settings.ColumnWidth)); SettingsBinder.DataBindSetting<bool>(cb_ExtractComments, "Checked", _settings, nameof(_settings.ExtractComments)); }
/// <summary> /// Calls Automatic task method for data binding /// </summary> /// <param name="settings"></param> public void SetSettings(GeneratorSettings settings) { _settings = settings; SettingsBinder.DataBindSetting <bool>(rb_ExcludeStatus, "Checked", _settings, nameof(_settings.ExcludeStatus)); SettingsBinder.DataBindSetting <bool>(rb_ExcludeCategory, "Checked", _settings, nameof(_settings.ExclusionTypeCategory)); SettingsBinder.DataBindSetting <bool>(cb_DontExportExact, "Checked", _settings, nameof(_settings.DontExportExact)); SettingsBinder.DataBindSetting <bool>(cb_DontExportContext, "Checked", _settings, nameof(_settings.DontExportContext)); SettingsBinder.DataBindSetting <bool>(cb_DontExportFuzzy, "Checked", _settings, nameof(_settings.DontExportFuzzy)); SettingsBinder.DataBindSetting <bool>(cb_DontExportNoMatch, "Checked", _settings, nameof(_settings.DontExportNoMatch)); UpdateUI(settings); }
/// <summary> /// Calls Automatic task method for data binding /// </summary> /// <param name="settings"></param> public void SetSettings(GeneratorSettings settings) { _settings = settings; SettingsBinder.DataBindSetting<bool>(rb_ExcludeStatus, "Checked", _settings, nameof(_settings.ExcludeStatus)); SettingsBinder.DataBindSetting<bool>(rb_ExcludeCategory, "Checked", _settings, nameof(_settings.ExclusionTypeCategory)); SettingsBinder.DataBindSetting<bool>(cb_DontExportExact, "Checked", _settings, nameof(_settings.DontExportExact)); SettingsBinder.DataBindSetting<bool>(cb_DontExportContext, "Checked", _settings, nameof(_settings.DontExportContext)); SettingsBinder.DataBindSetting<bool>(cb_DontExportFuzzy, "Checked", _settings, nameof(_settings.DontExportFuzzy)); SettingsBinder.DataBindSetting<bool>(cb_DontExportNoMatch, "Checked", _settings, nameof(_settings.DontExportNoMatch)); UpdateUI(settings); }
public void Initialize(string outputFile, GeneratorSettings settings) { //reset main settings ConversionSettings = settings; // Create a spreadsheet document by supplying the filepath. // By default, AutoSave = true, Editable = true, and Type = xlsx. ExcelDocument = SpreadsheetDocument.Create(outputFile, SpreadsheetDocumentType.Workbook); // Add a WorkbookPart to the document. ExcelWorkbookPart = ExcelDocument.AddWorkbookPart(); ExcelWorkbookPart.Workbook = new Workbook(); ExcelWorkbookPart.Workbook.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); // Add a WorksheetPart to the WorkbookPart. ExcelWorkSheetPart = ExcelWorkbookPart.AddNewPart <WorksheetPart>(); ExcelWorkSheetPart.Worksheet = SetWorksheetData(); // Add Sheets to the Workbook. Sheets sheets = ExcelDocument.WorkbookPart.Workbook.AppendChild <Sheets>(new Sheets()); // Append a new worksheet and associate it with the workbook. Sheet sheet = new Sheet() { Id = ExcelDocument.WorkbookPart.GetIdOfPart(ExcelWorkSheetPart), SheetId = 1, Name = "Exported data" }; sheets.Append(sheet); // Get the SharedStringTablePart. ExcelSharedStringsTable = ExcelDocument.WorkbookPart.AddNewPart <SharedStringTablePart>(); //Set custom styles WorkbookStylesPart workbookStylesPart = ExcelDocument.WorkbookPart.AddNewPart <WorkbookStylesPart>(); workbookStylesPart.Stylesheet = GenerateStylesheet(); ExcelStyleSheet = ExcelDocument.WorkbookPart.WorkbookStylesPart.Stylesheet; CreateHeader(); // Save the new worksheet. ExcelWorkSheetPart.Worksheet.Save(); }
/// <summary> /// Updates the settings that user selected /// </summary> /// <param name="settings"></param> public void UpdateSettings(GeneratorSettings settings) { _settings = settings; _settings.DontExportContext = cb_DontExportContext.Checked; _settings.DontExportExact = cb_DontExportExact.Checked; _settings.DontExportFuzzy = cb_DontExportFuzzy.Checked; _settings.DontExportNoMatch = cb_DontExportNoMatch.Checked; _settings.ExcludedStatuses.Clear(); foreach (SegmentStatus item in cbl_ExcludedStatuses.CheckedItems) { _settings.ExcludedStatuses.Add(item.Status); } if (rb_ExcludeStatus.Checked) { _settings.ExcludeExportType = GeneratorSettings.ExclusionType.Status; } else { _settings.ExcludeExportType = GeneratorSettings.ExclusionType.Category; } }
public void UpdateSettings(GeneratorSettings settings) { _settings = settings; }
public Worker(GeneratorSettings settings) { _settings = settings; }
public FileReader(DataExtractor dataExtr, GeneratorSettings settings, string filePath) { _dataExtractor = dataExtr; _convertSettings = settings; _originalFilePath = filePath; }
/// <summary> /// Initialize settings for the project /// </summary> protected override void OnInitializeTask() { _settings = GetSetting <GeneratorSettings>(); }
/// <summary> /// Initialize settings for the project /// </summary> protected override void OnInitializeTask() { _settings = GetSetting<GeneratorSettings>(); }
public void Initialize(string outputFile, GeneratorSettings settings) { //reset main settings ConversionSettings = settings; // Create a spreadsheet document by supplying the filepath. // By default, AutoSave = true, Editable = true, and Type = xlsx. ExcelDocument = SpreadsheetDocument.Create(outputFile, SpreadsheetDocumentType.Workbook); // Add a WorkbookPart to the document. ExcelWorkbookPart = ExcelDocument.AddWorkbookPart(); ExcelWorkbookPart.Workbook = new Workbook(); ExcelWorkbookPart.Workbook.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); // Add a WorksheetPart to the WorkbookPart. ExcelWorkSheetPart = ExcelWorkbookPart.AddNewPart<WorksheetPart>(); ExcelWorkSheetPart.Worksheet = SetWorksheetData(); // Add Sheets to the Workbook. Sheets sheets = ExcelDocument.WorkbookPart.Workbook.AppendChild<Sheets>(new Sheets()); // Append a new worksheet and associate it with the workbook. Sheet sheet = new Sheet() { Id = ExcelDocument.WorkbookPart.GetIdOfPart(ExcelWorkSheetPart), SheetId = 1, Name = "Exported data" }; sheets.Append(sheet); // Get the SharedStringTablePart. ExcelSharedStringsTable = ExcelDocument.WorkbookPart.AddNewPart<SharedStringTablePart>(); //Set custom styles WorkbookStylesPart workbookStylesPart = ExcelDocument.WorkbookPart.AddNewPart<WorkbookStylesPart>(); workbookStylesPart.Stylesheet = GenerateStylesheet(); ExcelStyleSheet = ExcelDocument.WorkbookPart.WorkbookStylesPart.Stylesheet; CreateHeader(); // Save the new worksheet. ExcelWorkSheetPart.Worksheet.Save(); }