fixed problem saving margins in word attachment – can’t do if in a frame

sometines would get a weird file name for the opened word attachment
This commit is contained in:
John Jenko 2012-04-05 19:45:28 +00:00
parent bff0666d85
commit da009a15eb
2 changed files with 23 additions and 6 deletions

View File

@ -526,6 +526,9 @@ namespace VEPROMS.CSLA.Library
//ItemInfo sect = doc.DocumentEntries[0].MyContent.ContentItems[0]; //ItemInfo sect = doc.DocumentEntries[0].MyContent.ContentItems[0];
return ToPDFReplaceROs(sect, false, roids); return ToPDFReplaceROs(sect, false, roids);
} }
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static string ToPDFReplaceROs(ItemInfo sect, bool openPdf, List<string> roids) //, System.Drawing.Color overrideColor, System.Windows.Forms.Form myForm) public static string ToPDFReplaceROs(ItemInfo sect, bool openPdf, List<string> roids) //, System.Drawing.Color overrideColor, System.Windows.Forms.Form myForm)
{ {
string fileName = GetFileName(sect); string fileName = GetFileName(sect);
@ -574,7 +577,14 @@ namespace VEPROMS.CSLA.Library
} }
} }
LBDocumentClass myDoc = MyApp.Documents.Open(myFile.FullName, false); LBDocumentClass myDoc = MyApp.Documents.Open(myFile.FullName, false);
AdjustMargins(myDocStyle, myDoc, true); try
{
AdjustMargins(myDocStyle, myDoc, true);
}
catch (Exception ex)
{
_MyLog.Error("Could not Adjust Margins",ex);
}
LBSelection selxy = hasRos ? FindXyPlot() : null; LBSelection selxy = hasRos ? FindXyPlot() : null;
while (selxy != null) while (selxy != null)
{ {
@ -733,10 +743,13 @@ namespace VEPROMS.CSLA.Library
//Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", newTop, newLeft, newLength, newWidth, oldTop, oldLeft, oldBottom, oldRight,oldHeight,oldWidth); //Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", newTop, newLeft, newLength, newWidth, oldTop, oldLeft, oldBottom, oldRight,oldHeight,oldWidth);
if (printingMode) if (printingMode)
{ {
myDoc.PageSetup.BottomMargin = 0;// 11 * 72 - (newTop + newLength); if (myDoc.PageSetup.BottomMargin != 9999999)
myDoc.PageSetup.RightMargin = newRight; {
myDoc.PageSetup.LeftMargin = newLeft; myDoc.PageSetup.BottomMargin = 0; // 11 * 72 - (newTop + newLength);
myDoc.PageSetup.TopMargin = newTop; myDoc.PageSetup.RightMargin = newRight;
myDoc.PageSetup.LeftMargin = newLeft;
myDoc.PageSetup.TopMargin = newTop;
}
} }
else else
{ {

View File

@ -324,7 +324,11 @@ namespace Volian.Controls.Library
return; return;
} }
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument); LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName"); string tmp = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
if (System.IO.File.Exists(tmp))
MyDSOFile.FullName = tmp;
else
_MyLog.FatalFormat("File does not exist {0}\r\nFile was {1}", tmp, MyDSOFile.FullName);
// if this was a library document, ask user if it should be saved for all usages. // if this was a library document, ask user if it should be saved for all usages.
bool cvtLibDoc = false; bool cvtLibDoc = false;
EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry; EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;