Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all 1741 articles
Browse latest View live

New Post: Cannot find the NetOffice equivalent for Microsoft.Office.Tools (.Excel.Controls)

$
0
0
Hi rixeblitz,

Wanted to check if you could eventually get the controls-stuff working through NetOffice somehow, and if yes / possible, share some details please.

Was the approach suggested by geirg earlier in this thread of any use in this context?

Regards.

Commented Unassigned: Com Exception when set cell values [21059]

$
0
0
Hi all

Following code (Example 1) work fine on Excel 2010/2013 x86, windows x64 but don't work on Excel 2010/2013 x86, windows x32:
```
public void RunExample()
{
// start excel and turn off msg boxes
Excel.Application excelApplication = new Excel.Application();
excelApplication.DisplayAlerts = false;

// add a new workbook
Excel.Workbook workBook = excelApplication.Workbooks.Add();
Excel.Worksheet workSheet = (Excel.Worksheet)workBook.Worksheets[1];

// draw back color and perform the BorderAround method
workSheet.Range("$B2:$B5").Interior.Color = ToDouble(Color.DarkGreen);
workSheet.Range("$B2:$B5").BorderAround(XlLineStyle.xlContinuous, XlBorderWeight.xlMedium, XlColorIndex.xlColorIndexAutomatic);

// draw back color and border the range explicitly
workSheet.Range("$D2:$D5").Interior.Color = ToDouble(Color.DarkGreen);
workSheet.Range("$D2:$D5").Borders[XlBordersIndex.xlInsideHorizontal].LineStyle = XlLineStyle.xlDouble;
workSheet.Range("$D2:$D5").Borders[XlBordersIndex.xlInsideHorizontal].Weight = 4;
workSheet.Range("$D2:$D5").Borders[XlBordersIndex.xlInsideHorizontal].Color = ToDouble(Color.Black);

workSheet.Cells[1, 1].Value = "We have 2 simple shapes created.";

decimal d1=(decimal) 1.0099;
decimal d2 = (decimal)10001;

try
{
// Error here:
workSheet.Cells[10, 2].Formula = string.Format("={0}*{1}", d1, d2);
}
catch (Exception e)
{

throw;
}


// save the book
string fileExtension = GetDefaultExtension(excelApplication);
string workbookFile = string.Format("{0}\\Example01{1}", _hostApplication.RootDirectory, fileExtension);
workBook.SaveAs(workbookFile);

// close excel and dispose reference
excelApplication.Quit();
excelApplication.Dispose();

// show dialog for the user(you!)
_hostApplication.ShowFinishDialog(null, workbookFile);
}
```

StackTrace = " at NetOffice.Invoker.PropertySet(COMObject comObject, String name, Object[] value)\r\n at NetOffice.ExcelApi.Range.set_Formula(Object value)\r\n at ExcelExamplesCS4.Example01.RunExample() in c:\\Users\\thangtx\\Desktop\\netoffice-106580\\Examples\\E...
Comments: ** Comment from web user: thangtx **

Any update on this issue? I have alot of problem when run project on Windows 7, Windows 8 x86.

Regards

Commented Unassigned: Detect NetOffice assembly OfficeApi. Type:SEHException Message:外部组件发生异常。 [21090]

$
0
0
IFactoryInfo:WordApi, Version=1.6.0.0, Culture=neutral, PublicKeyToken=4ce962cc9e5644e3:VBIDEApi, Version=1.6.0.0, Culture=neutral, PublicKeyToken=6040f8ab492f76a1
IFactoryInfo:OfficeApi, Version=1.6.0.0, Culture=neutral, PublicKeyToken=1208423a019d3443:VBIDEApi, Version=1.6.0.0, Culture=neutral, PublicKeyToken=6040f8ab492f76a1
IFactoryInfo:VBIDEApi, Version=1.6.0.0, Culture=neutral, PublicKeyToken=6040f8ab492f76a1:VBIDEApi, Version=1.6.0.0, Culture=neutral, PublicKeyToken=6040f8ab492f76a1
Attribute:System.Diagnostics.DebuggableAttribute
Attribute:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute
Attribute:System.Reflection.AssemblyTitleAttribute
Attribute:System.Reflection.AssemblyDescriptionAttribute
Attribute:System.Reflection.AssemblyConfigurationAttribute
Attribute:System.Reflection.AssemblyCompanyAttribute
Attribute:System.Reflection.AssemblyProductAttribute
Attribute:System.Reflection.AssemblyCopyrightAttribute
Attribute:System.Reflection.AssemblyTrademarkAttribute
Attribute:System.Reflection.AssemblyFileVersionAttribute
NetOffice.Factory.Initialize() passed
NetOffice.Factory.Initialize() DeepLevel:True
Failed to resolve Assembly
Try to resolve Assembly
Failed to resolve Assembly
Failed to resolve Assembly
Failed to resolve Assembly
Failed to resolve Assembly
Failed to resolve Assembly
Detect NetOffice assembly OfficeApi.
Type:SEHException
Message:外部组件发生异常。
Target:System.RuntimeMethodHandle ResolveMethod(Int32, System.RuntimeTypeHandle*, Int32, System.RuntimeTypeHandle*, Int32)
Stack: 在 System.ModuleHandle.ResolveMethod(Int32 methodToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
在 System.ModuleHandle.ResolveMethodHandle(Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
在 System.ModuleHandle.ResolveMethodHandle(Int32 methodToken)
在 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
在 System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
在 System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType)
在 System.Reflection.Assembly.GetCustomAttributes(Boolean inherit)
在 NetOffice.Factory.AddAssembly(String name, Assembly itemAssembly)
在 NetOffice.Factory.AddNetOfficeAssemblies(Boolean deepLevel)
在 NetOffice.Factory.Initialize()
Comments: ** Comment from web user: cgh_chen **

Sorry for not write the reason late.

BUG is Not For NetOffice. I start a new trhead to monitor a variable which hold the COMObjects of Word, So that I can Dipose them when timeout.

I start the thread in DoConnection as:

private bool DoConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst) {
if (_wordApplication != null)
return true;
try {
AssemblyResolver.Register();
//NetOffice.Factory.ProxyCountChanged += new NetOffice.Factory.ProxyCountChangedHandler(Factory_ProxyCountChanged);
//StartMonitor();

System.AppDomain domain = AppDomain.CurrentDomain;
log4n.Info(domain.BaseDirectory);
Step("Startup OK...");
Step("OnConnection 0" + Application);
_wordApplication = new WordAPI.Application(null, Application);
Step("OnConnection 1");
_commandBars = _wordApplication.CommandBars;

This code runs OK in WIN7, BUT in XP raise SEHException.

New Post: How can I connect to the current instance of an application by the file name?

$
0
0
Hi.

I'm also very much interested in this.

I'm writing a companion product for Word. (but not a plugin).

From the companion app, I need to find Word instance of a given filename.

But it doesn't seem to work.

If I have 3 word instances open, and I do this:
                foreach (Application word_application in Application.GetActiveInstances())
                {
                    foreach (Window window in word_application.Windows)
                    {
                        if (filename == window.Document.FullName)
                        {
                            //Do good stuff here
                        }
                    }
                }

it doesn't work.

Application.GetActiveInstances() returns 3 applications,

but window is always the same, first instance.

How can I get to the file I need?

Many thanks.

Created Unassigned: 3th party mail client hangs when sending mail [21097]

$
0
0
I made an Outlook-addin using NetOffice.
When I use Word, Excel or AdobeReader to send a mail, I get then SendMail-window from Outlook.
When I press the Send-button, I get my popup from my Outlook-addin as expected, and when I press OK, the mail is send. Then the SendMail-window is closed, and the Notification-Icon in the Notification-Tray says "Outlook is closing", but the Outlook-process is never closed, neither the Notification Icon, and my Word, Excel or AdobeReader is hanging. When Outlook was already running before, is also keeps hanging.
Eventually, I have to kill my Word, Excel or AdobeReader process.

When I try this on my computer, it works fine (I am Administrator of my machine). My colleague is not Admin, and it also works for him, but for the users in production, it doesn't work. We all have Office 2013, AdobeReader XI and Windows 7.

I think it might be a cleanup issue, and I noticed I never receive the OnBeginShutdown- or OnDisconnection-event.
Any idea on how to approach this problem?

Commented Unassigned: Toolbox 1.2 won't start - loadFromRemoteSources [21009]

$
0
0
Hi,

I tried to install NetOffice 1.6 and the corresponding Toolbox 1.2 because I use Visual Studio Express 2013.

The toolbox is located on C:\tools\... but when I try to start it, I get an error message (see attached screenshot):
```
1 | An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information. | NotSupportedException | Void .ctor()
```
I run on Windows 7 64bit with Office 2010 and .NET 4.5.

Any ideas?
Thanks.
Comments: ** Comment from web user: MacShee **


New Post: Cannot find the NetOffice equivalent for Microsoft.Office.Tools (.Excel.Controls)

$
0
0
Hi dd1985,

actually I have not realized the proposal due to the fact that I have too many Microsoft.Office.Tools - Controls in use - so many that a workaround for me as a non-software-engineer would be too complex. I would love to use Net Office, but I am depending on the MS.Office.Tools, which I have understood, are not directly covered by NetOffice. Nevertheless I am following the evolution of Net Office and hope that in the future also Office.Tools are included. Most Office-developers probably do not need MS.Office.Tools can be delighted to use such a perfect software as NetOffice to avoid the vendor-lock-in.

Sorry, for not giving you software details neither being able to report any experiences with the above code snippets.

Best regards,
Rixeblitz

New Post: Application.GetActiveInstances() returns wrong excel instances

$
0
0
Hello,

I am currently discovering the netoffice project and I am quite impressed by what you did at the moment.

I have just a little issue about the Application.GetActiveInstances().

Here is the snippet I use (At this time I have one instance that actually is visible on my desktop and on "fake" instance I use for tests):
         Application xl = new Application();
        List<Application> apps = Application.GetActiveInstances().ToList();

        apps.RemoveAll(app => app.Visible == false);

        return apps;
Actually apps contains 2 instances after Application.GetActiveInstances() but my filter on the visible property is not working whereas I have only one visble on my desktop.

Even stranger, the instance created in the code has the same caption as the other instance which is quite disturbing.

Is that a real issue or am I doing something wrong ?

Thanks

Created Unassigned: Using SaveAs on Workbook not working [21130]

$
0
0
I have opened a file in Excel but when I try to use the workbook SaveAs method no errors are generated but the file does not get saved.

(I have Excel v15)

if (excelVersion >= 12.0)
book.SaveAs(useFilename, XlFileFormat.xlWorkbookDefault);
else
book.SaveAs(useFilename);

New Post: open .doc file

$
0
0
Hello,

I don't find sample in c# for opening a .doc file.

I have tried Documents.open2000(), Documents.openOld(), etc...
Always have an exception.
It is the same as with Microsoft.Office.Interop.

I have Office 1010 on my computer and i can open without problem these files with WinWord applications.
API works for .DOCX files

Any suggest ?

best regards.

Created Unassigned: Is there a way to make Word open in readonly and not beable to edit the document [21132]

$
0
0
I can open a Word document as readonly so the [Read-only] shows but I want to disable the editing too. Is there additional options to stop people from being able to edit the document?

Created Unassigned: Is it possible to open a Word document and place the document viewer in a winforms form area? [21133]

$
0
0
I would like to place a document in my own winforms form. This used to be possible with OLE but MS have stopped supporting OLE. Does NetOffice provide a way to do this?

Commented Unassigned: Using SaveAs on Workbook not working [21130]

$
0
0
I have opened a file in Excel but when I try to use the workbook SaveAs method no errors are generated but the file does not get saved.

(I have Excel v15)

if (excelVersion >= 12.0)
book.SaveAs(useFilename, XlFileFormat.xlWorkbookDefault);
else
book.SaveAs(useFilename);
Comments: ** Comment from web user: ekirk0 **

Did you find a solution?

This is how I persist a copy of the file from an open document.

http://blogs.msdn.com/b/pranavwagh/archive/2008/04/03/how-to-do-a-save-copy-as-in-word.aspx

http://stackoverflow.com/questions/8981118/how-can-i-save-the-contents-of-an-oleobject-as-a-file-in-an-automated-way

```
using System.IO;
using COM = System.Runtime.InteropServices.ComTypes;
using System.Runtime.InteropServices;

public static bool PersistFile(object underlyingObject, string newfilePath)
{
COM.IPersistFile pp = (COM.IPersistFile)underlyingObject;

pp.Save(newfilePath, false);

return File.Exists(newfilePath);

}
```

Commented Unassigned: Is there a way to make Word open in readonly and not be able to edit the document [21132]

$
0
0
I can open a Word document as readonly so the [Read-only] shows but I want to disable the editing too. Is there additional options to stop people from being able to edit the document?
Comments: ** Comment from web user: ekirk0 **


http://office.microsoft.com/en-us/excel-help/what-is-protected-view-HA010355931.aspx

create a NetOffice.WordApi.ProtectedViewWindow for your document.

```
//detecting if in protected mode.
NetOffice.WordApi.ProtectedViewWindow protectedViewWindow = Application.ActiveProtectedViewWindow;
if (protectedViewWindow != null)
{
return;
}
```

Created Unassigned: Error loading COMAddin in PowerPoint [21139]

$
0
0
Hi all,

I have been experiencing a problem since changing over to NetOffice with my COMAddin, but only for some users who were using the VSTO version of the addin. Developed using Visual Studio 2010 SP1, Visual Studio generated msi, and Wix bootstrapper to deal with 32 and 64 bit Office versions, it's an addin for PowerPoint.

The issue is when loading the addin in PowerPoint is "Location: mscoree.dll. Load behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in." Registry setting for the Addin's LoadBehavor changes from 3 to 2.

I have researched for months and applied so many of the suggested changes from msdn, stackexchange and codeplex that I am now out of ideas and perplexed as to what else I need to do to get it working. Users uninstall the old version and deploy the new NetOffice version and then the addin never works again. Here's some details of the things I've implemented or changed to get it working.

Bootstrapper details
- Two Wix bootstrappers developed one a current user install and another for an all user install.
- Each boostrapper detects whether 32bit or 64bit Office is installed and calls either the embedded 32 or 64 bit msi installer.
- End user is given one bootstrapper or the other
=> No issues here from Wix install logs.

msi installer
- four msi installers built an included in the two bootstrappers, one for each office bitness and All User (UAC prompt)/Current install (no UAC prompt) option
- The Target Platform set specifically to x86 or x64, rather than AnyCPU to avoid issues of incompatible bitness with office bitness
- Registry entries seem to be deployed to the correct places for both the Current User and All User installs
- Files are deployed to the correct place for the Current User (C:\Users\xxx\AppData\Local\MyAppName\AppName.dll + NO DLLs
- Files are deployed to the correct place for the All Users (C:\Users\Public\Documents\MyAppName\AppName.dll + NO DLLs
- msi's are signed and timestamped
- MyApp DLLs are strong named and signed
=> Files and registry entries seem to be in correct locations for all of the four MSIs

Addin code:
- ComVisible flags set to true for the class and main project, and other classes as required, false for everything else
- The addin Inherits COMAddin Implements Office.IRibbonExtensibility, IDTExtensibility2
- OnConnection code is in a try/catch statement and debugs/exceptions written to text file
=> Code is working fine for most users, but some who had the old addin installed never have the first line of the code executed

Startup
- Netoffice and MyApp addin's DLLs and dependencies (resources and XML serializers) are being loaded correctly as reported by Fusion (Default)
- Some errors reported by Fusion for Native Issue, but apparently these should be ignored?? (http://stackoverflow.com/questions/9734919/what-is-this-fusion-log-saying - see Hans Passant response)
- if the DLLs are not found, even a probe file for POWERPNT.EXE.config to find the correct DLLs is in place and Fusion reports successes, but even when the DLLs are found the addin still doesn't load
- The first line of OnConnection code does not seem to execute on computers with issues

Some things that may be outstanding for consideration or comment:
- Cached versions of old dlls causing - how to find/remove them to ensure there is not some conflict?
- Use of the GAC? But if all DLLs are loaded assume this is not required? GAC also breaks ability to run a the No Admin installer
- Shim issues - if the DLLs are being loaded and the first line of code is not executing, could it be something in between like Shim?
- Any other suggestions related to an addin working on VSTO and then changing to Netoffice that I need to take into account?

Any assistance or pointers appreciated.

Commented Unassigned: Error loading COMAddin in PowerPoint [21139]

$
0
0
Hi all,

I have been experiencing a problem since changing over to NetOffice with my COMAddin, but only for some users who were using the VSTO version of the addin. Developed using Visual Studio 2010 SP1, Visual Studio generated msi, and Wix bootstrapper to deal with 32 and 64 bit Office versions, it's an addin for PowerPoint.

The issue is when loading the addin in PowerPoint is "Location: mscoree.dll. Load behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in." Registry setting for the Addin's LoadBehavor changes from 3 to 2.

I have researched for months and applied so many of the suggested changes from msdn, stackexchange and codeplex that I am now out of ideas and perplexed as to what else I need to do to get it working. Users uninstall the old version and deploy the new NetOffice version and then the addin never works again. Here's some details of the things I've implemented or changed to get it working but without success. The only way to solve is for the user to get a new computer, so assume it's an issue that is resolvable in the registry/file system/GAC/CLR/Shim/Fusion/etc.

Bootstrapper details
- Two Wix bootstrappers developed one a current user install and another for an all user install.
- Each boostrapper detects whether 32bit or 64bit Office is installed and calls either the embedded 32 or 64 bit msi installer.
- End user is given one bootstrapper or the other
=> No issues here from Wix install logs.

msi installer
- four msi installers built an included in the two bootstrappers, one for each office bitness and All User (UAC prompt)/Current install (no UAC prompt) option
- The Target Platform set specifically to x86 or x64, rather than AnyCPU to avoid issues of incompatible bitness with office bitness
- Registry entries seem to be deployed to the correct places for both the Current User and All User installs
- Files are deployed to the correct place for the Current User (C:\Users\xxx\AppData\Local\MyAppName\AppName.dll + NO DLLs
- Files are deployed to the correct place for the All Users (C:\Users\Public\Documents\MyAppName\AppName.dll + NO DLLs
- msi's are signed and timestamped
- MyApp DLLs are strong named and signed
=> Files and registry entries seem to be in correct locations for all of the four MSIs

Addin code:
- ComVisible flags set to true for the class and main project, and other classes as required, false for everything else
- The addin Inherits COMAddin Implements Office.IRibbonExtensibility, IDTExtensibility2
- OnConnection code is in a try/catch statement and debugs/exceptions written to text file
=> Code is working fine for most users, but some who had the old addin installed never have the first line of the code executed

Startup
- Netoffice and MyApp addin's DLLs and dependencies (resources and XML serializers) are being loaded correctly as reported by Fusion (Default)
- Some errors reported by Fusion for Native Issue, but apparently these should be ignored?? (http://stackoverflow.com/questions/9734919/what-is-this-fusion-log-saying - see Hans Passant response)
- if the DLLs are not found, even a probe file for POWERPNT.EXE.config to find the correct DLLs is in place and Fusion reports successes, but even when the DLLs are found the addin still doesn't load
- The first line of OnConnection code does not seem to execute on computers with issues
- LoadBehavor is changed from 3 to 2 and error " Load behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in". Addin is not in disabled items - just not ticked to load anymore on startup.

Some things that may be outstanding for consideration or comment:
- Cached versions of old dlls causing - how to find/remove them to ensure there is not some conflict 9even though the probe file should point the CLR to the right location?
- Use of the GAC? But if all DLLs are loaded assume this is not required? GAC also breaks ability to run a the No Admin installer
- Shim issues - if the DLLs are being loaded and the first line of code is not executing, could it be something in between like Shim?
- Any other suggestions related to an addin working on VSTO and then changing to Netoffice that I need to take into account?

Any assistance or pointers appreciated.
Comments: ** Comment from web user: ekirk0 **


> Each boostrapper detects whether 32bit or 64bit Office is installed and calls either the embedded 32 or 64 bit msi installer.

What is your detection strategy. As a 64 bit computer can have a 32 or 64 bit install of an office app. A 32 bit office app cannot see into the ProgramFiles64Folder or System64Folder. Same goes for the registry hive. MS does some tricks with emulation of the hive based on if the process is 32 or 64 bit.

/////////

Is there any difference to your issue when installing on a computer that has never had your product installed vs one where you have installed/uninstalled/upgraded?

/////////

Had this issue when the Count value does not get incremented on upgrades. Suggest increment this count each build.
HKLM\SOFTWARE\Microsoft\Office\14.0\User Settings\SomeApp.PowerPointAddin

http://blogs.msdn.com/b/mshneer/archive/2007/09/05/deploying-your-vsto-add-in-to-all-users-part-ii.aspx

Newer versions of office use the user setting feature to populate key into the HKCU(curent user) hive.
When the office application starts the registry keys here will be populated into the users hive for use.
The one issue is the orphaning of HKCU addin keys. They are not removed by the installer nor office unless a delete is created.

Commented Unassigned: Error loading COMAddin in PowerPoint [21139]

$
0
0
Hi all,

I have been experiencing a problem since changing over to NetOffice with my COMAddin, but only for some users who were using the VSTO version of the addin. Developed using Visual Studio 2010 SP1, Visual Studio generated msi, and Wix bootstrapper to deal with 32 and 64 bit Office versions, it's an addin for PowerPoint.

The issue is when loading the addin in PowerPoint is "Location: mscoree.dll. Load behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in." Registry setting for the Addin's LoadBehavor changes from 3 to 2.

I have researched for months and applied so many of the suggested changes from msdn, stackexchange and codeplex that I am now out of ideas and perplexed as to what else I need to do to get it working. Users uninstall the old version and deploy the new NetOffice version and then the addin never works again. Here's some details of the things I've implemented or changed to get it working but without success. The only way to solve is for the user to get a new computer, so assume it's an issue that is resolvable in the registry/file system/GAC/CLR/Shim/Fusion/etc.

Bootstrapper details
- Two Wix bootstrappers developed one a current user install and another for an all user install.
- Each boostrapper detects whether 32bit or 64bit Office is installed and calls either the embedded 32 or 64 bit msi installer.
- End user is given one bootstrapper or the other
=> No issues here from Wix install logs.

msi installer
- four msi installers built an included in the two bootstrappers, one for each office bitness and All User (UAC prompt)/Current install (no UAC prompt) option
- The Target Platform set specifically to x86 or x64, rather than AnyCPU to avoid issues of incompatible bitness with office bitness
- Registry entries seem to be deployed to the correct places for both the Current User and All User installs
- Files are deployed to the correct place for the Current User (C:\Users\xxx\AppData\Local\MyAppName\AppName.dll + NO DLLs
- Files are deployed to the correct place for the All Users (C:\Users\Public\Documents\MyAppName\AppName.dll + NO DLLs
- msi's are signed and timestamped
- MyApp DLLs are strong named and signed
=> Files and registry entries seem to be in correct locations for all of the four MSIs

Addin code:
- ComVisible flags set to true for the class and main project, and other classes as required, false for everything else
- The addin Inherits COMAddin Implements Office.IRibbonExtensibility, IDTExtensibility2
- OnConnection code is in a try/catch statement and debugs/exceptions written to text file
=> Code is working fine for most users, but some who had the old addin installed never have the first line of the code executed

Startup
- Netoffice and MyApp addin's DLLs and dependencies (resources and XML serializers) are being loaded correctly as reported by Fusion (Default)
- Some errors reported by Fusion for Native Issue, but apparently these should be ignored?? (http://stackoverflow.com/questions/9734919/what-is-this-fusion-log-saying - see Hans Passant response)
- if the DLLs are not found, even a probe file for POWERPNT.EXE.config to find the correct DLLs is in place and Fusion reports successes, but even when the DLLs are found the addin still doesn't load
- The first line of OnConnection code does not seem to execute on computers with issues
- LoadBehavor is changed from 3 to 2 and error " Load behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in". Addin is not in disabled items - just not ticked to load anymore on startup.

Some things that may be outstanding for consideration or comment:
- Cached versions of old dlls causing - how to find/remove them to ensure there is not some conflict 9even though the probe file should point the CLR to the right location?
- Use of the GAC? But if all DLLs are loaded assume this is not required? GAC also breaks ability to run a the No Admin installer
- Shim issues - if the DLLs are being loaded and the first line of code is not executing, could it be something in between like Shim?
- Any other suggestions related to an addin working on VSTO and then changing to Netoffice that I need to take into account?

Any assistance or pointers appreciated.
Comments: ** Comment from web user: scottaj **


Some great questions ekirk0 - let me expand to see if it shines some light on the problem:

1. 32/64 bit office detection strategy: The 32 or 64bit msi installer is launched depending on the detection of existence of PowerPoint Path from the 32 or 64bit branch of the registry - HKLM\SOFTWARE\Microsoft\Office\X.0\PowerPoint\InstallRoot\Path (where X is 12, 14 or 15)
=> There is no obvious issues here that I can find as the 32 and 64 versions are installed for new users without an issue. However for existing users the installer installs correctly, the registry entries are ready, DLLs are loaded as shown by Fusion, but addin errors after DLLs are loaded and therefore changes LoadBehavior from 3 to 2. Have I missed anything here?

2. Differences in new vs upgrades: The issues seems to be on installing a new version of the Addin when an existing version exists. This is mostly from the old "All User" VSTO version of the addin to the new Current User or All User NetOffice version of the addin. The Current User msi install (no admin permission required) deploys files to c:\Users and registry entries to HKCU, while the All user (Admin UAC) deploys to the Program Files ([ProgramFiles64Folder] for 64bit, and [ProgramFilesFolder] for 32bit msi) and HKLM registry. The "Current user" msi won't uninstall the old Addin as it requires Admin permissions, but even if the user manually does it themselves, there is still an issue. How can I find if something is cached or force the addin to look for the new version of the file in a new location? Maybe the MyAddin.DLL.Manifest Addin registry setting to force PowerPoint to find the location of the new files?

3. This is an interesting article that I hadn't come across in months of research and does show a nice mechanism to add a HKLM registry into the HKCU on startup. However, as I am successfully deploying the current user key to this branch, I don't really see any advantage. Is there something else that the UserSetting registry does here that I've missed?

I did notice the orphaning issue of addin registry branches on uninstall if DeleteUninstall = False, but as I set DeleteUninstall = True I changed the uninstall of the old msi within Orca to occur before the install of the new version. The result is slightly slower to install, but guarantees the registry branch will remain in tact no matter whether the old version DeleteUninstall is set to True or False, as the uninstall is done first rather than last.

Thanks

Commented Unassigned: Error loading COMAddin in PowerPoint [21139]

$
0
0
Hi all,

I have been experiencing a problem since changing over to NetOffice with my COMAddin, but only for some users who were using the VSTO version of the addin. Developed using Visual Studio 2010 SP1, Visual Studio generated msi, and Wix bootstrapper to deal with 32 and 64 bit Office versions, it's an addin for PowerPoint.

The issue is when loading the addin in PowerPoint is "Location: mscoree.dll. Load behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in." Registry setting for the Addin's LoadBehavor changes from 3 to 2.

I have researched for months and applied so many of the suggested changes from msdn, stackexchange and codeplex that I am now out of ideas and perplexed as to what else I need to do to get it working. Users uninstall the old version and deploy the new NetOffice version and then the addin never works again. Here's some details of the things I've implemented or changed to get it working but without success. The only way to solve is for the user to get a new computer, so assume it's an issue that is resolvable in the registry/file system/GAC/CLR/Shim/Fusion/etc.

Bootstrapper details
- Two Wix bootstrappers developed one a current user install and another for an all user install.
- Each boostrapper detects whether 32bit or 64bit Office is installed and calls either the embedded 32 or 64 bit msi installer.
- End user is given one bootstrapper or the other
=> No issues here from Wix install logs.

msi installer
- four msi installers built an included in the two bootstrappers, one for each office bitness and All User (UAC prompt)/Current install (no UAC prompt) option
- The Target Platform set specifically to x86 or x64, rather than AnyCPU to avoid issues of incompatible bitness with office bitness
- Registry entries seem to be deployed to the correct places for both the Current User and All User installs
- Files are deployed to the correct place for the Current User (C:\Users\xxx\AppData\Local\MyAppName\AppName.dll + NO DLLs
- Files are deployed to the correct place for the All Users (C:\Users\Public\Documents\MyAppName\AppName.dll + NO DLLs
- msi's are signed and timestamped
- MyApp DLLs are strong named and signed
=> Files and registry entries seem to be in correct locations for all of the four MSIs

Addin code:
- ComVisible flags set to true for the class and main project, and other classes as required, false for everything else
- The addin Inherits COMAddin Implements Office.IRibbonExtensibility, IDTExtensibility2
- OnConnection code is in a try/catch statement and debugs/exceptions written to text file
=> Code is working fine for most users, but some who had the old addin installed never have the first line of the code executed

Startup
- Netoffice and MyApp addin's DLLs and dependencies (resources and XML serializers) are being loaded correctly as reported by Fusion (Default)
- Some errors reported by Fusion for Native Issue, but apparently these should be ignored?? (http://stackoverflow.com/questions/9734919/what-is-this-fusion-log-saying - see Hans Passant response)
- if the DLLs are not found, even a probe file for POWERPNT.EXE.config to find the correct DLLs is in place and Fusion reports successes, but even when the DLLs are found the addin still doesn't load
- The first line of OnConnection code does not seem to execute on computers with issues
- LoadBehavor is changed from 3 to 2 and error " Load behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in". Addin is not in disabled items - just not ticked to load anymore on startup.

Some things that may be outstanding for consideration or comment:
- Cached versions of old dlls causing - how to find/remove them to ensure there is not some conflict 9even though the probe file should point the CLR to the right location?
- Use of the GAC? But if all DLLs are loaded assume this is not required? GAC also breaks ability to run a the No Admin installer
- Shim issues - if the DLLs are being loaded and the first line of code is not executing, could it be something in between like Shim?
- Any other suggestions related to an addin working on VSTO and then changing to Netoffice that I need to take into account?

Any assistance or pointers appreciated.
Comments: ** Comment from web user: ekirk0 **

Maybe there is an issue with the com that isn't apparent. Make a simple vb/js script that loads your com object by name. Then execute a function of that com object. This will help you determine if this is either com object references messed up or something else. Make a version property to return some info.

```
var type = System.Type.GetTypeFromProgID("name of com class");
var obj = Activator.CreateInstance(type);
obj.Version
```

have you thought about using wix to build your msi also. vsto has its limitations especially if you have to bust out orca to change things.

Commented Unassigned: Is there a way to make Word open in readonly and not be able to edit the document [21132]

$
0
0
I can open a Word document as readonly so the [Read-only] shows but I want to disable the editing too. Is there additional options to stop people from being able to edit the document?
Comments: ** Comment from web user: JAustin **

So I have a word document this is not in protected mode but I want to open it in read only protected mode. I don't see how that works in code.

New Post: OUTLOOK 2013 - ItemContextMenuDisplayEvent

$
0
0
Hi All,
what i need is to add a custom choices into mail items' context menu.
What i'm trying to do is to catch the context menu display event, but with no luck,
(taken from here http://www.noordam.it/writing-a-context-menu-outlook-addin/[TEXT](http://www.noordam.it/writing-a-context-menu-outlook-addin/)
here's a branch of my IDTExtensibility2.OnConnection event code:
Try
            _outlookApplication = New Outlook.Application(Nothing, Application)
        Catch ex As Exception
            Dim message As String = String.Format("Errore.{0}{0}{1}", Environment.NewLine, ex.Message)
            MessageBox.Show(message, _progId, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
        If Not _outlookApplication Is Nothing Then
            AddHandler _outlookApplication.NewMailExEvent, AddressOf NuovoMessaggio
            AddHandler _outlookApplication.ItemContextMenuDisplayEvent, AddressOf ApplicationItemContextMenuDisplay             
        End If
here's the event handler:
Private Sub ApplicationItemContextMenuDisplay(CommandBar As Office.CommandBar, Selection As Outlook.Selection) 
        messagebox.show("click")        
    End Sub
Any idea about where i'm wrong?
TIA
Daniele.
Viewing all 1741 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>