Added File extension parameter to Make Document
Support for DocX and correction of Import Word Doc file Change button from Print to Report Support opening a Library Document that does not have any usages.
This commit is contained in:
parent
d452b2f5b3
commit
e22458bd1a
@ -272,7 +272,7 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
private void InitializeWordDocument(LBDocumentClass doc)
|
private void InitializeWordDocument(LBDocumentClass doc)
|
||||||
{
|
{
|
||||||
if (MyDocumentInfo.Config == null || MyDocumentInfo.Config == "")
|
if (MyDocumentInfo.Config == null || MyDocumentInfo.Config == "" && MyDocumentInfo.DocumentEntryCount > 0)
|
||||||
{
|
{
|
||||||
DocStyle ds = MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].MyDocStyle;
|
DocStyle ds = MyDocumentInfo.DocumentEntries[0].MyContent.ContentItems[0].MyDocStyle;
|
||||||
// this will cause an error and goto the Catch if the family or size is null,
|
// this will cause an error and goto the Catch if the family or size is null,
|
||||||
|
@ -186,7 +186,7 @@ namespace Volian.Controls.Library
|
|||||||
this.btnPrint.Name = "btnPrint";
|
this.btnPrint.Name = "btnPrint";
|
||||||
this.btnPrint.Size = new System.Drawing.Size(75, 30);
|
this.btnPrint.Size = new System.Drawing.Size(75, 30);
|
||||||
this.btnPrint.TabIndex = 15;
|
this.btnPrint.TabIndex = 15;
|
||||||
this.btnPrint.Text = "Print";
|
this.btnPrint.Text = "Report";
|
||||||
this.btnPrint.UseVisualStyleBackColor = true;
|
this.btnPrint.UseVisualStyleBackColor = true;
|
||||||
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
||||||
//
|
//
|
||||||
|
@ -38,7 +38,7 @@ namespace Volian.Controls.Library
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
btnOpenLibDoc.Enabled = false;
|
btnOpenLibDoc.Enabled = false;
|
||||||
btnDelLibDoc.Enabled = false;
|
btnDelLibDoc.Enabled = false;
|
||||||
btnPrint.Enabled = false;
|
btnPrint.Enabled = listBoxLibDocs.Items.Count > 0;
|
||||||
saveGroupPanelUsages = groupPanelUsages.Style.BackColor;
|
saveGroupPanelUsages = groupPanelUsages.Style.BackColor;
|
||||||
}
|
}
|
||||||
DisplayTabControl _DisplayTabControl;
|
DisplayTabControl _DisplayTabControl;
|
||||||
@ -60,6 +60,7 @@ namespace Volian.Controls.Library
|
|||||||
_DisplayTabControl = tc;
|
_DisplayTabControl = tc;
|
||||||
listBoxUsages.Items.Clear();
|
listBoxUsages.Items.Clear();
|
||||||
_InitializingLibDocList = false;
|
_InitializingLibDocList = false;
|
||||||
|
btnPrint.Enabled = listBoxLibDocs.Items.Count > 0;
|
||||||
}
|
}
|
||||||
public void SetSelectedLibDoc()
|
public void SetSelectedLibDoc()
|
||||||
{
|
{
|
||||||
@ -122,10 +123,10 @@ namespace Volian.Controls.Library
|
|||||||
btnOpenLibDoc.Enabled = false;
|
btnOpenLibDoc.Enabled = false;
|
||||||
foreach (ItemInfo ii in dicnt.LibraryDocumentUsageList)
|
foreach (ItemInfo ii in dicnt.LibraryDocumentUsageList)
|
||||||
{
|
{
|
||||||
if(ii.MyDocVersion!=null)
|
if (ii.MyDocVersion != null)
|
||||||
listBoxUsages.Items.Add(ii.MyProcedure.ToString() + " - " + ii.MyContent.Number + " " + ii.MyContent.Text);
|
listBoxUsages.Items.Add(ii.MyProcedure.ToString() + " - " + ii.MyContent.Number + " " + ii.MyContent.Text);
|
||||||
}
|
}
|
||||||
btnPrint.Enabled = listBoxUsages.Items.Count > 0 ? true : false;
|
btnPrint.Enabled = listBoxLibDocs.Items.Count > 0 ? true : false;
|
||||||
}
|
}
|
||||||
private void btnDelLibDoc_Click(object sender, EventArgs e)
|
private void btnDelLibDoc_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -204,7 +205,7 @@ namespace Volian.Controls.Library
|
|||||||
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
||||||
|
|
||||||
openFileDialog1.InitialDirectory = "c:\\";
|
openFileDialog1.InitialDirectory = "c:\\";
|
||||||
openFileDialog1.Filter = "Word files (*.doc;*.rtf)|*.doc;*.rtf|All files (*.*)|*.*";
|
openFileDialog1.Filter = "Word files (*.doc;*.rtf;*.docx)|*.doc;*.rtf;*.docx|All files (*.*)|*.*";
|
||||||
openFileDialog1.FilterIndex = 0;
|
openFileDialog1.FilterIndex = 0;
|
||||||
openFileDialog1.RestoreDirectory = true;
|
openFileDialog1.RestoreDirectory = true;
|
||||||
|
|
||||||
@ -215,7 +216,7 @@ namespace Volian.Controls.Library
|
|||||||
while (done == 0 && ntry < 4)
|
while (done == 0 && ntry < 4)
|
||||||
{
|
{
|
||||||
ntry++;
|
ntry++;
|
||||||
done = SaveTheDoc(openFileDialog1.FileName, openFileDialog1.SafeFileName.Substring(0,openFileDialog1.SafeFileName.LastIndexOf(".")));
|
done = SaveTheDoc(openFileDialog1.FileName, openFileDialog1.SafeFileName.Substring(0, openFileDialog1.SafeFileName.LastIndexOf(".")));
|
||||||
}
|
}
|
||||||
if (done > 0)
|
if (done > 0)
|
||||||
{
|
{
|
||||||
@ -223,7 +224,7 @@ namespace Volian.Controls.Library
|
|||||||
// set selectedindex to the imported doc...
|
// set selectedindex to the imported doc...
|
||||||
int indx = 0;
|
int indx = 0;
|
||||||
DocumentInfoList dil = DocumentInfoList.GetLibraries(true);
|
DocumentInfoList dil = DocumentInfoList.GetLibraries(true);
|
||||||
for(int i = 0; i<listBoxLibDocs.Items.Count; i++)
|
for (int i = 0; i < listBoxLibDocs.Items.Count; i++)
|
||||||
{
|
{
|
||||||
if (dil[i].DocID == done)
|
if (dil[i].DocID == done)
|
||||||
{
|
{
|
||||||
@ -239,13 +240,14 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
FileInfo fi = new FileInfo(temppath);
|
||||||
FileStream fs = File.Open(temppath, FileMode.Open, FileAccess.Read, FileShare.None);
|
FileStream fs = File.Open(temppath, FileMode.Open, FileAccess.Read, FileShare.None);
|
||||||
long len = fs.Length + 1;
|
long len = fs.Length;
|
||||||
byte[] ByteArray = new byte[len];
|
byte[] ByteArray = new byte[len];
|
||||||
int nBytesRead = fs.Read(ByteArray, 0, (int)len);
|
int nBytesRead = fs.Read(ByteArray, 0, (int)len);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
string t1 = (title == null || title == "") ? null : title;
|
string t1 = (title == null || title == "") ? null : title;
|
||||||
Document doc = Document.MakeDocument(t1, ByteArray, null, null); //, DateTime.Now, "Migration");
|
Document doc = Document.MakeDocument(t1, ByteArray, null, null, fi.Extension); //, DateTime.Now, "Migration");
|
||||||
return doc.DocID;
|
return doc.DocID;
|
||||||
}
|
}
|
||||||
// for an io exception, keep trying
|
// for an io exception, keep trying
|
||||||
@ -300,7 +302,7 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
private void btnPrint_Click(object sender, EventArgs e)
|
private void btnPrint_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OnPrintRequest(new DisplayLibDocEventArgs("Library Document Usage",LibDocList));
|
OnPrintRequest(new DisplayLibDocEventArgs("Library Document Usage", LibDocList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class DisplayLibDocEventArgs
|
public class DisplayLibDocEventArgs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user