Skip to content

Commit

Permalink
Merge branch 'release-7.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
bovender committed Sep 11, 2016
2 parents 9742b8a + e181ebe commit c6730fe
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ lib/
source.zip
7za.exe
.backup/
*.tmp_proj
4 changes: 2 additions & 2 deletions Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.1.2.0")]
[assembly: AssemblyFileVersion("7.1.2.0")]
[assembly: AssemblyVersion("7.1.3.0")]
[assembly: AssemblyFileVersion("7.1.3.0")]
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
7.1.2
7.1.2.0
7.1.3
7.1.3.0
2 changes: 1 addition & 1 deletion XLToolbox/Excel/ViewModels/Instance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ internal string LoadAddinFromEmbeddedResource(string resourceName)
resourceStream.CopyTo(tempStream);
tempStream.Close();
resourceStream.Close();
Workbooks.Open(addinPath);
Workbooks.Open(addinPath, CorruptLoad: XlCorruptLoad.xlExtractData);
Logger.Info("LoadAddinFromEmbeddedResource: Loaded {0}", addinPath);
}
else
Expand Down
9 changes: 8 additions & 1 deletion XLToolbox/Export/DibBitmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,14 @@ private IntPtr Scan0
if (_scan0 == IntPtr.Zero)
{
IntPtr handlePtr = DibHandle.AddrOfPinnedObject();
_scan0 = new IntPtr(handlePtr.ToInt32() + 40);
if (Environment.Is64BitProcess)
{
_scan0 = new IntPtr(handlePtr.ToInt64() + 40);
}
else
{
_scan0 = new IntPtr(handlePtr.ToInt32() + 40);
}
}
return _scan0;
}
Expand Down
4 changes: 2 additions & 2 deletions XLToolbox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.1.2.0")]
[assembly: AssemblyFileVersion("7.1.2.0")]
[assembly: AssemblyVersion("7.1.3.0")]
[assembly: AssemblyFileVersion("7.1.3.0")]
82 changes: 55 additions & 27 deletions XLToolbox/WorkbookStorage/Store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,43 +102,31 @@ public string Context {

#region Protected properties

protected Worksheet StoreSheet {
get {
if (_storeSheet == null) {
protected Worksheet StoreSheet
{
get
{
if (_storeSheet == null)
{
if (Workbook == null)
{
throw new WorkbookStorageException("Cannot access storage worksheet: no workbook is associated");
}
Sheets sheets = Workbook.Worksheets;
try
{
_storeSheet = Workbook.Worksheets[STORESHEETNAME];
_storeSheet = sheets[STORESHEETNAME];
}
catch (System.Runtime.InteropServices.COMException)
{
bool wasSaved = Workbook.Saved;
dynamic previousSheet = Workbook.ActiveSheet;
dynamic previousSel = Workbook.Application.Selection;

// If the COMException is raised, the worksheet likely does not exist
Sheets sheets = Workbook.Worksheets;
_storeSheet = sheets.Add();
Bovender.ComHelpers.ReleaseComObject(sheets);

// xlSheetVeryHidden hides the sheet so much that it cannot be made
// visible from the Excel graphical user interface
_storeSheet.Visible = XlSheetVisibility.xlSheetVeryHidden;

// Give the worksheet a special name
_storeSheet.Name = STORESHEETNAME;

previousSheet.Activate();
previousSel.Select();
Workbook.Saved = wasSaved;
CreateStoreWorksheet();
}
Bovender.ComHelpers.ReleaseComObject(sheets);
}
return _storeSheet;
}
}

protected bool Dirty { get; set; }

#endregion
Expand Down Expand Up @@ -459,22 +447,62 @@ protected void WriteToWorksheet()
Dirty = false;
}

/// <summary>
/// Creates a hidden storage worksheet
/// </summary>
private void CreateStoreWorksheet()
{
bool wasSaved = Workbook.Saved;
dynamic previousSheet = Workbook.ActiveSheet;
dynamic previousSel = Workbook.Application.Selection;
Sheets sheets = Workbook.Worksheets;

// If the COMException is raised, the worksheet likely does not exist
_storeSheet = sheets.Add();

// xlSheetVeryHidden hides the sheet so much that it cannot be made
// visible from the Excel graphical user interface
_storeSheet.Visible = XlSheetVisibility.xlSheetVeryHidden;

// Give the worksheet a special name
_storeSheet.Name = STORESHEETNAME;

if (previousSheet != null)
{
previousSheet.Activate();
Bovender.ComHelpers.ReleaseComObject(previousSheet);
}
if (previousSel != null)
{
previousSel.Select();
Bovender.ComHelpers.ReleaseComObject(previousSel);
}
Workbook.Saved = wasSaved;
Bovender.ComHelpers.ReleaseComObject(sheets);
}

#endregion

#region Private methods

private void PrepareStoreSheet()
{
Range usedRange = _storeSheet.UsedRange;
usedRange.Clear();
Bovender.ComHelpers.ReleaseComObject(usedRange);
if (usedRange != null)
{
usedRange.Clear();
Bovender.ComHelpers.ReleaseComObject(usedRange);
}

// Put an informative string into the first cell;
// this is also required in order for GetUsedRange() to return
// the correct range.
Range cells = _storeSheet.Cells;
cells[1, 1] = STORESHEETINFO;
Bovender.ComHelpers.ReleaseComObject(cells);
if (cells != null)
{
cells[1, 1] = STORESHEETINFO;
Bovender.ComHelpers.ReleaseComObject(cells);
}
}

#endregion
Expand Down
4 changes: 2 additions & 2 deletions XLToolboxForExcel/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.1.2.0")]
[assembly: AssemblyFileVersion("7.1.2.0")]
[assembly: AssemblyVersion("7.1.3.0")]
[assembly: AssemblyFileVersion("7.1.3.0")]

[assembly: NeutralResourcesLanguageAttribute("en-US")]

0 comments on commit c6730fe

Please sign in to comment.