Updated code to save Ascii text to DocAscii field.
Added code to look for and replace Symbol Characters.
This commit is contained in:
parent
24c892b008
commit
5d03ff7368
@ -140,6 +140,7 @@ namespace Volian.Controls.Library
|
|||||||
//this.GotFocus += new EventHandler(DSOTabPanel_GotFocus);
|
//this.GotFocus += new EventHandler(DSOTabPanel_GotFocus);
|
||||||
//this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
|
//this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
CheckForSymbolCharacters();
|
||||||
FindSearchString();
|
FindSearchString();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -150,6 +151,17 @@ namespace Volian.Controls.Library
|
|||||||
// TODO: Should try to do a direct open using Word.
|
// TODO: Should try to do a direct open using Word.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckForSymbolCharacters()
|
||||||
|
{
|
||||||
|
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
|
||||||
|
if (doc.HasSymbolCharacters)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("This document contains Symbol Characters.\r\n\r\nDo you want to correct this?",
|
||||||
|
"Replace Symbol Characters", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
doc.FixSymbolCharacters();
|
||||||
|
}
|
||||||
|
}
|
||||||
public void FindSearchString()
|
public void FindSearchString()
|
||||||
{
|
{
|
||||||
if (SearchString == null) return;
|
if (SearchString == null) return;
|
||||||
@ -159,7 +171,8 @@ namespace Volian.Controls.Library
|
|||||||
LBFind find = wordDoc.Application.Selection.Find;
|
LBFind find = wordDoc.Application.Selection.Find;
|
||||||
find.ClearFormatting();
|
find.ClearFormatting();
|
||||||
bool wildCards = SearchString.Contains("?") || SearchString.Contains("*");
|
bool wildCards = SearchString.Contains("?") || SearchString.Contains("*");
|
||||||
Console.WriteLine("find = {0}", find.Execute(SearchString, false, false, wildCards, false, false, true, LBWdFindWrap.wdFindContinue,null,null,null,false,false,false,false));
|
bool found = find.Execute(SearchString, false, false, wildCards, false, false, true, LBWdFindWrap.wdFindContinue, null, null, null, false, false, false, false);
|
||||||
|
//Console.WriteLine("find = {0}", found);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Text will either replace current selection or be inserted at the current cursor position if no selection
|
/// Text will either replace current selection or be inserted at the current cursor position if no selection
|
||||||
@ -256,7 +269,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
|
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
|
||||||
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
|
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
|
||||||
MyDSOFile.SaveFile(doc.Length);
|
MyDSOFile.SaveFile(doc.Length,doc.Ascii);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Before a document closes check to see if it's contents should be saved.
|
/// Before a document closes check to see if it's contents should be saved.
|
||||||
@ -333,7 +346,7 @@ namespace Volian.Controls.Library
|
|||||||
_MyDSOFramer.Save();
|
_MyDSOFramer.Save();
|
||||||
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
|
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
|
||||||
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
|
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
|
||||||
MyDSOFile.SaveFile(doc.Length);
|
MyDSOFile.SaveFile(doc.Length, doc.Ascii);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -349,7 +362,7 @@ namespace Volian.Controls.Library
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool SaveDirty()
|
public bool SaveDirty()
|
||||||
{
|
{
|
||||||
if (_MyDSOFramer.IsDirty)
|
if (_MyDSOFramer != null && _MyDSOFramer.IsDirty)
|
||||||
{
|
{
|
||||||
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
|
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
|
||||||
if (PanelViewEditMode == E_ViewMode.View)
|
if (PanelViewEditMode == E_ViewMode.View)
|
||||||
@ -382,6 +395,8 @@ namespace Volian.Controls.Library
|
|||||||
_MyLog.Debug("CloseDSO");
|
_MyLog.Debug("CloseDSO");
|
||||||
bool result = true;
|
bool result = true;
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (_MyDSOFramer != null)
|
||||||
{
|
{
|
||||||
SaveDirty();
|
SaveDirty();
|
||||||
_MyDSOFramer.Close();
|
_MyDSOFramer.Close();
|
||||||
@ -391,6 +406,7 @@ namespace Volian.Controls.Library
|
|||||||
_MyDSOFramer = null;
|
_MyDSOFramer = null;
|
||||||
_Count--;
|
_Count--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO - " + this.Name, ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO - " + this.Name, ex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user