Exemplo n.º 1
0
        /// <summary>
        /// This method was called from the host instance after selection changed.
        /// </summary>
        /// <param name="selectedRange">active selection</param>
        private void Application_SheetSelectionChangeEvent(NetOffice.COMObject sh, Excel.Range selectedRange)
        {
            try
            {
                // we check for auto translation and skip selections with more than 256 cells for this simple example
                if (checkBoxAutoTranslate.Checked && selectedRange.Count <= 256)
                {
                    ClearError();
                    textBoxTranslation.Text = string.Empty;
                    foreach (var item in selectedRange)
                    {
                        string requestedText = item.Text as string;
                        if (!String.IsNullOrWhiteSpace(requestedText))
                        {
                            string translatedText = Client.DataService.Translate(
                                comboBoxSourceLanguage.SelectedItem as string,
                                comboBoxTargetLanguage.SelectedItem as string,
                                requestedText);
                            textBoxTranslation.Text += translatedText + " ";
                        }
                    }
                }

                sh.Dispose();
                selectedRange.Dispose();
            }
            catch (Exception exception)
            {
                ShowError(string.Format("An errror occured. Details: {0}", exception.Message));
            }
        }
Exemplo n.º 2
0
        private void WorkSheetSelectionChangeEvent(NetOffice.COMObject Sh, Excel.Range Target)
        {
            if (Globals.sheet.Name == "BPM批次新增使用者")
            {
                if (Target.Column == 3)
                {
                    if (organizationUnitSelector == null)
                    {
                        organizationUnitSelector = new OrganizationUnitSelector();
                    }

                    if (Target.Value2.HasValue())
                    {
                        organizationUnitSelector.selectedOrganizationUnitId = Target.Value2.ToString();
                    }

                    organizationUnitSelector.ShowDialog();

                    if (organizationUnitSelector.selectedOrganizationUnitId.HasValue())
                    {
                        Target.Value2 = organizationUnitSelector.selectedOrganizationUnitId;
                        organizationUnitSelector.selectedOrganizationUnitId = "";
                    }
                }
            }
        }
Exemplo n.º 3
0
 void WorksheetActivateEvent(NetOffice.COMObject Sh)
 {
     Globals.sheet = (Excel.Worksheet)Sh;
 }