예제 #1
0
        private bool CutContent(Microsoft.Office.Tools.Word.RichTextContentControl ctrl)
        {
            int length = 0;

            if (ctrl.Equals(Globals.ThisDocument.txtDescrizione))
            {
                length = ThisDocument.DESCRIZIONE_MAX_LEN;
            }
            else if (ctrl.Equals(Globals.ThisDocument.txtNote))
            {
                length = ThisDocument.NOTE_MAX_LEN;
            }
            else if (ctrl.Equals(Globals.ThisDocument.txtOggetto))
            {
                length = ThisDocument.OGGETTO_MAX_LEN;
            }

            if (ctrl.Text.Length > length)
            {
                if (!_originalControlText.ContainsKey(ctrl.ID))
                {
                    _originalControlText.Add(ctrl.ID, ctrl.Text);
                }
                else
                {
                    _originalControlText[ctrl.ID] = ctrl.Text;
                }

                ctrl.Text = ctrl.Text.Substring(0, Math.Min(ctrl.Text.Length, length));

                return(true);
            }
            return(false);
        }
예제 #2
0
        private void UncutContent(Microsoft.Office.Tools.Word.RichTextContentControl ctrl)
        {
            ctrl.Text = _originalControlText[ctrl.ID];

            int length = 0;

            if (ctrl.Equals(Globals.ThisDocument.txtDescrizione))
            {
                length = ThisDocument.DESCRIZIONE_MAX_LEN;
            }
            else if (ctrl.Equals(Globals.ThisDocument.txtNote))
            {
                length = ThisDocument.NOTE_MAX_LEN;
            }
            else if (ctrl.Equals(Globals.ThisDocument.txtOggetto))
            {
                length = ThisDocument.OGGETTO_MAX_LEN;
            }

            Globals.ThisDocument.FormatTextOverDimension(ctrl, length, ctrl.Text.Length > length);
        }