Added Insert and Replace buttons
Added comments with a link to the sendkeys key commands Logic to let the Import Word Contents form know which edit item should receive the key strokes
This commit is contained in:
@@ -14,6 +14,13 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
LBApplicationClass _WordApp;
|
||||
bool _initializing = false;
|
||||
private StepRTB _MyStepRTB = null;
|
||||
|
||||
public StepRTB MyStepRTB
|
||||
{
|
||||
get { return _MyStepRTB; }
|
||||
set { _MyStepRTB = value; }
|
||||
}
|
||||
public frmImportWordContents()
|
||||
{
|
||||
_initializing = true;
|
||||
@@ -91,7 +98,10 @@ namespace Volian.Controls.Library
|
||||
_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 1);
|
||||
try
|
||||
{
|
||||
int idx = _WordApp.Selection.Text.IndexOfAny("\t".ToCharArray());
|
||||
//int idx = _WordApp.Selection.Text.IndexOfAny("\t".ToCharArray());
|
||||
int idx = -1;
|
||||
if (_WordApp.Selection.Text.EndsWith("\t(\r") || _WordApp.Selection.Text.EndsWith("\t___\r"))
|
||||
idx = _WordApp.Selection.Text.LastIndexOf("\t");
|
||||
if (idx > 0)
|
||||
txbWrdText.Text = _WordApp.Selection.Text.Substring(0, idx);
|
||||
else
|
||||
@@ -113,13 +123,17 @@ namespace Volian.Controls.Library
|
||||
_WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1);
|
||||
try
|
||||
{
|
||||
int idx = _WordApp.Selection.Text.IndexOfAny("\t".ToCharArray());
|
||||
//int idx = _WordApp.Selection.Text.IndexOfAny("\t".ToCharArray());
|
||||
int idx = -1;
|
||||
if (_WordApp.Selection.Text.EndsWith("\t(\r") || _WordApp.Selection.Text.EndsWith("\t___\r"))
|
||||
idx = _WordApp.Selection.Text.LastIndexOf("\t");
|
||||
if (idx > 0)
|
||||
txbWrdText.Text = _WordApp.Selection.Text.Substring(0, idx);
|
||||
else
|
||||
txbWrdText.Text = _WordApp.Selection.Text;
|
||||
txbWrdText.Text = txbWrdText.Text.Replace('\xA0', ' '); // replace hard space with regular space
|
||||
txbWrdText.Text = txbWrdText.Text.Replace('\x0B', ' '); // replace hard return with regular space
|
||||
txbWrdText.Text = txbWrdText.Text.Replace("\t", " "); // replace tabs with 5 regular spaces
|
||||
|
||||
txvStyle.Text = _WordApp.Selection.Style.NameLocal;
|
||||
txbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString();
|
||||
@@ -128,13 +142,12 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
//_WordApp.Selection.Copy();
|
||||
//string tmp = Clipboard.GetText(TextDataFormat.Html);
|
||||
//EditItem ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem;
|
||||
//while (ei.Enabled == false)
|
||||
// ei = ei.MyParentEditItem ?? ei.MyPreviousEditItem;
|
||||
//ei.MyStepRTB.Focus();
|
||||
|
||||
//if (MyStepRTB != null)
|
||||
//{
|
||||
// MyStepRTB.RtbSendKeys("^+i");
|
||||
// MyStepRTB.RtbSendKeys("^v");
|
||||
//}
|
||||
}
|
||||
|
||||
private void txbWordFile_TextChanged(object sender, EventArgs e)
|
||||
@@ -154,5 +167,31 @@ namespace Volian.Controls.Library
|
||||
// incase user manually closed word
|
||||
}
|
||||
}
|
||||
|
||||
private void btnNextIns_Click(object sender, EventArgs e)
|
||||
{
|
||||
//btnNext_Click(sender, e);
|
||||
if (MyStepRTB != null)
|
||||
{
|
||||
if (MyStepRTB.MyItemInfo.IsSection)
|
||||
{
|
||||
MyStepRTB.RtbSendKeys("^{DOWN}"); // down arrow
|
||||
MyStepRTB.RtbSendKeys("^+b"); // insert previous
|
||||
}
|
||||
else
|
||||
MyStepRTB.RtbSendKeys("^+i"); // insert next (same type and level)
|
||||
MyStepRTB.RtbSendKeys("^v"); // clipboard paste
|
||||
}
|
||||
}
|
||||
|
||||
private void btnNextRpl_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MyStepRTB != null)
|
||||
{
|
||||
MyStepRTB.RtbSendKeys("^{DOWN}"); // move to next edit window
|
||||
MyStepRTB.RtbSendKeys("^a"); // select all
|
||||
MyStepRTB.RtbSendKeys("^v"); // clipboard paste
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user