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

New Post: Converting Interop object to NetOffice Object


Commented Unassigned: How can I initialize NetOffice.WordApi objects using a Microsoft.Office.Interop objects? [22069]

$
0
0
I have a Microsoft Office Addin Project on Visual Studio. It uses Microsoft.Office.Interop.dll . Within the code logic, I need to use NetOffice.WordApi instead of the regular Interop assemblies. My question is this: Since NetOffice is a wrapper to Microsoft.Office.Interop.dll , How can I initialize a NetOffice.WordApi objects using a Microsoft.Office.Interop objects (e.g. Application -> Application , INDocument -> NODocument or Table to Table)
Comments: ** Comment from web user: AndreasWaning **

I have the same Problem. Could you give me sign, if I find a solution ?
> a.waning (at) gmx.de
Thanks Andreas

Commented Unassigned: How can I initialize NetOffice.WordApi objects using a Microsoft.Office.Interop objects? [22069]

$
0
0
I have a Microsoft Office Addin Project on Visual Studio. It uses Microsoft.Office.Interop.dll . Within the code logic, I need to use NetOffice.WordApi instead of the regular Interop assemblies. My question is this: Since NetOffice is a wrapper to Microsoft.Office.Interop.dll , How can I initialize a NetOffice.WordApi objects using a Microsoft.Office.Interop objects (e.g. Application -> Application , INDocument -> NODocument or Table to Table)
Comments: ** Comment from web user: SebastianDotNet **

In NetOffice 1.7.3 you have to use the ctor from the corresponding wrapper class.
The following examples used a non-existing method called "CreateObject" which is the same like the VB6 well-known method to create a new COM class trough late-binding.

example1 - Word Application

object interopProxy = CreateObject("Word.Application");
NetOffice.WordApi.Application app = new NetOffice.WordApi.Application(null, interopProxy);

example2 - Word Document
object interopProxy = CreateObject("Word.Document);
NetOffice.WordApi.Document document = new NetOffice.WordApi.Document(null, interopProxy);

may nice to know:
I've been created some static methods in NetOffice 1.7.4 to do this easier because its a common problem for beginners. Its something like:

var managedNetOfficeWrapper = COMObject.CreateInstanceFromProxy(interopProxy);
// netoffice analyze the proxy and creates the corresponding wrapper automaticaly - you have to cast the result from the common base class COMObject to its actual type.

moreover: as far i remember, the NO 1.7.3 includes a tutorial how to face this challenge. you may give'em a try ;) ( i know, the most open-source projects doesnt spend a good explanation/documentation. I alyways try to do this better like a commercial/professional project. Its need the same time as the development - please do me pleasure and spend 5-10 minutes for the tutorials)

"The tutorials are sufficient to understand what makes NetOffice tick. Great info!"
- a customer feedback from a United States company

*Sebastian


New Post: Newbie Question - Project Templates For VS Community 2015

$
0
0
I have a VBA Word addin and I was looking to convert it to VSTO so I downloaded VS Community 2015 and added VSTO using MS Web Platform Installer. While looking for VSTO info I accidentally ran across NetOffice. I was really impressed and want to try it. I downloaded and created a project using the NO toolbox. I was wondering if there was a way to directly install the templates in VS Community 2015 similar to VSTO.

New Post: Newbie Question - Project Templates For VS Community 2015

$
0
0
hey men,

i didnt find a question or i'm blind :o

2 years ago i've been created a visual extension to put some project templates and wizards to visual studio.
BUT only few people have using it and is very expensive to develope and support them(also for multiple visual studio version). for this reason - i drop them
to save time and energy for the toolbox project wizard. if you want to use VS 2015, please use VS210 Express as option in the wizard because its full compatible.
(and make sure set the option "Use NetOffice Tool" because its more familar to VSTO)

*Sebastian

Commented Unassigned: NullReferenceException on ExcelApi.Application.GetActiveInstances() [22037]

$
0
0
Hi,

calling
```
ExcelApi.Application.GetActiveInstances()
```
with an open Excel instance which has no workbooks visibly opened (i.e. start excel and close or hide the default workbook) causes a NullReferenceException.


I tracked it down to the excel hot fix in GetActiveProxiesFromROT and the subsequent proxy lookup by hWnd.
If no workbook is visible there seems to be no EXCEL7 window and the lookup returns a null reference, which then causes the NullReferenceException on COMObject instantiation.

Best regards,
Andreas
Comments: ** Comment from web user: SebastianDotNet **

thanks for the notification. the main problem behind is: you can see all COM instance in ROT but only the first is accessible. This is why GetActiveObject in VB6/VBA has the same problem. You can't decide which instance you want and i've been implemented the hotfix.

Is it NetOffice 1.7.3 ?

I want change the implementation this weekend.

*Sebastian

Commented Unassigned: Extracolors property is not IENumerable in powerpoint 2007 [22035]

$
0
0
Hi

I noticed (thorugh add-in failing) that in powerpoint 2007 the extracolors object does not act like a "real" collection, that is it does not implement the IEnumerable methods.

In effect it's impossible to iterate over the collection with foreach, instead one must use a for loop with own counter. Doing the latter is not a problem as such, but one could consider whereever the NetOffice proxy type should reflect this (i.e. be something else than a collection?)
Comments: ** Comment from web user: SebastianDotNet **

I'm currently figure out whats the problem. is it a collection in VBA or interop ???

*sry powerpoint content and development targets in netoffice is a bit slower from the flagships(excel, word, outlook) because we dont have enough users here. (please keep in your mind, its an open source project and i do all this in my free time)

what i can say is: NetOffice spend a 1:1 and better inferface to the inerop assemblies(also PowerPoint)
but if its possible i want make the extracolors to an IEnumerable<T> of course.
(This is not easy - because i have to veryfiy this alwas these type - otherwise i can't do this)

*Sebastian


New Post: Newbie Question - Project Templates For VS Community 2015

$
0
0
Thanks. The project wizard works well. I just got started on VSTO when I found NetOffice. Looking forward to using NetOffice

New Post: Possible to Customize Quick Access Toolbar?

$
0
0
Using NetOffice I have customized my ribbon and added my custom images to the ribbon. Is it possible to add references to the Quick Access Toolbar (QAT). In a regular Word VBA addin I use the Custom UI Editor for MS Office to create items on the ribbon then I manually customize the QAT referencing items on the custom ribbon. If you unzip the addin (dotm) you see the QAT xml file 'customUI.xml' in the 'userCustomization' directory'.
<?xml version="1.0" encoding="UTF-8"?>
<mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2006/01/customui" xmlns:doc="http://schemas.microsoft.com/office/2006/01/customui/currentDocument">
   <mso:ribbon>
      <mso:qat>
         <mso:documentControls>
            <mso:control idQ="doc:LabOnBt" visible="true" />
            <mso:control idQ="doc:OfficeOnBt" visible="true" />
         </mso:documentControls>
      </mso:qat>
   </mso:ribbon>
</mso:customUI>
It would be great if QAT customization was possible. If not, I could use the task pane to accomplish a one click solution.

Commented Unassigned: NullReferenceException on ExcelApi.Application.GetActiveInstances() [22037]

$
0
0
Hi,

calling
```
ExcelApi.Application.GetActiveInstances()
```
with an open Excel instance which has no workbooks visibly opened (i.e. start excel and close or hide the default workbook) causes a NullReferenceException.


I tracked it down to the excel hot fix in GetActiveProxiesFromROT and the subsequent proxy lookup by hWnd.
If no workbook is visible there seems to be no EXCEL7 window and the lookup returns a null reference, which then causes the NullReferenceException on COMObject instantiation.

Best regards,
Andreas
Comments: ** Comment from web user: SebastianDotNet **

BTW: do you have a stack trace, exception details(error code line number, etc.) for me?
Its more safe to pin point the (real)problem once and for all.

*Sebastian

New Post: How to Get Breakpoints Working?

$
0
0
I can't get the breakpoints to work on a NO Word addin. I created the addin using the NO Toolbox. I am using the project created by the toolbox, no mods. I load the project into VS 2015 Community and set a breakpoint on the About click . I run it using F5. Word 2010 loads and the addin installs. I click on About and the message shows the it doesn't breakpoint. If I debug a simple C# program it breakpoints fine. I have never debugged a DLL. Is there something I need to set?

I cleaned the project and built it again. I checked the debug properties and everything appears right, at least to me. I set breakpoints on other lines and nothing works.

Any suggestions are appreciated.

New Post: How to Get Breakpoints Working?

$
0
0
VS 2015 use the .Net 4.5 Debugger as default. If you have another .Net Framework version in your project you have to create a "Winword.exe.config" file in the same directory as Winword.exe.

This is an Winword.exe.config example content for targeting .Net framework version 2.

<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>

(This is not a NetOffice specific behavior)
*Sebastian

New Post: How to Get Breakpoints Working?

$
0
0
Thanks!!! Works now. The problem was there was already a WINWORD.EXE.CONFIG in the directory pointing to v2.0.50727.

Updated Wiki: Documentation

$
0
0

Why NetOffice?                                                                 english |deutsch|русский

The usual methods for accessing Microsoft Office. NET are the Primary InteropAssemblies and VSTO. Both access methods involve various disadvantages.

  • They are limited to a version, i.e. they only work with one or certain versions of Office 
  • They cause problems while transferring or installation on other systems 
  • They offer no protection mechanism in the management of COM proxies

NetOffice eliminates these disadvantages and remains a 1:1 wrapper that is syntactically and semantically identical to the interop assemblies. 


How does NetOffice work? 

NetOffice used to access only LateBinding Calls via COM Interop, but without sacrificing the convenience and simplicity of EarlyBind calls. The slim architecture and efficient design makes this only slightly slower than so-called EarlyBind calls in .NET (max. 10%). Events in NetOffice are implemented with a technique the author calls Dynamic EarlyBinding. Learn more about this in the technical documentation

  

NetOffice contains 16 assemblies. Why and which assemblies do I need for my desired Office application? 

All Office applications use types which are defined in other components/type libraries. These dependent type libraries are therefore given as an independent assembly. Each assembly also requires the NetOffice.dll assembly.  An overview which Office application integrates which additional assemblies can be found here. 

Deployment Table:

Office applicationsDependencies
ExcelApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
WordApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
OutlookApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
PowerPointApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
AccessApi.dll 
 OfficeApi.dll
 DAOApi.dll
 VBIDEApi.dll
 ADODBApi.dll
 OWC10Api.dll
 MSDATASRCApi.dll
 MSComctlLibApi.dll
 NetOffice.dll
  
MSProjectApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 MSHTMLApi.dll
 NetOffice.dll
  
VisioApi.dll 
 VisioApi.dll
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll

 

What do I have to do to deliver my application with NetOffice?

Nothing except copying the needed assemblies to the target system. You don't need a registration or something like that with the exception of COMAddIns. Managed COMAddins generally have to be registered via the .Net Utility RegAsm.exe or the Windows Installer do that or you.


Do COMAddins also work version independent?

Yes, of course. This is a particular strength of NetOffice. See the code examples for example project for all Office applications but you have to create 2 Addins for 32/64 Bit support.


Is NetOffice ready for multiple platforms(32/64 Bit)?

You can use the NetOffice AnyCPU assemblies in all scenarios. his is true regardless wether you develop for a 32Bit Office application or a 64Bit Office application, even independent on which platform these are installed. If your assembly is a standalone application (.exe) or is being loaded by one, you can compile your assembly as AnyCPU without worries.

If your assembly is a COMAddin that  is being loaded by a 32Bit Office application, you can still compile it as AnyCPU. If you develop a COMAddin that is being used by a 64Bit Office application, you have to compile your assembly as x64. If you wart to support 32Bit and 64Bit Office applications, you may need to provide a second x64-compiled COMAddin. This behaviour is the same in all scenarios(interop,vsto or netoffice). A 64Bit application can only load 64Bit Dll's.If you use a 64Bit Office for testing on your development system and you want to register your COMAddin while compiling (Register for COM Interop), you need to keep in mind that some older versions of Visual Studio call the 32Bit registration in that case. In this case, you get the following error:

"File <path to assembly> is not a valid assembly".
You can read a workarround by Microsoft here:
http://support.microsoft.com/kb/956933


How do I migrate my solution to NetOffice?

Interop Solutions: Change the references and the using(imports in vb) statements. Occasionally, you need to make some adjustments to event triggers. You have to replace all Marshall.ReleaseComObject calls with Dispose. you can also delete the most ReleaseComObject calls because NetOffice manages COM proxies for you. Read more about in the technical documentation:
Understanding COM Proxy Management

VBA Solutions: Developers there want changing a VBA solution to VB.NET and NetOffice has to know that VB.NET is syntactical similar to VBA but has also some different concepts. If you have good VB.NET skills then you have no problems to migrate your solution to NetOffice.

 
COM proxy management

If you call Office applications (COM servers) .NET returns instead of real objects so-called COM proxies. In order to signal the COM server that you no longer need this, you have to free it with a special method. This applies to VSTO as well as to interop assemblies.

Due to this fact, you must not use no objects implicitly or use Enumerator directly because it then can no longer be released. In NetOffice each object provides the method Dispose() for when you do not need it anymore. All classes in NetOffice implement the IDisposable interface and also provide the Dispose() method. However, you do not have to call Dispose() for every used object and you may also use objects implicitly and Enumerator directly without having to worry about releasing ti afterwards. NetOffice generated proxies stored in a separate table and frees when you request it or a parent object is being released. More on that in the technical documentation and Tutorial01.


Unknown and Variant Types

Many office applications include Properties, return values ​​or parameter whose type is not known at design time and which can change at run time, depending on context. There is a difference between unknown COM proxies and the variant data type which has its roots in the Visual Basic for Applications (VBA).

Unknown COM proxies in NetOffice have the type COMObject. Each class in NetOffice also inherits from this type. The declaration of unkown proxies isObject since NetOffice 1.5.1 as special service for VB developers to use the integrated late binding feature. You can also convert an anonymous COM proxy at run-time into the actual type without problems. 

The variant data type is used in VBA for any type to accept both a COM proxy and a scalar data type such as bool or int. In NetOffice that type is replaced by the type object. If a Variant Property is a COM proxy at run time you get an object of the corresponding NetOffice wrapper class, otherwise the the corresponding scalar data type.
More on that in thetechnical documentation andTutorial06.

 
If NetOffice supports all versions of Office, how do I know which Office version offerswhich functionality?

All classes, properties, methods, enums, etc. come with XML Documentation and have a special attribute that identifies which office version(s)  this entity support. You get this information displayed during development also through IntelliSense. Moreover, it is possible to examine an assembly (created with NetOffice) withNetOffice.DeveloperToolbox which Office versions are used practically. Use this opportunity before shipping your assembly to make sure that your program works with the Office versions that you (or your customers) have specified. 

Screenshot: IntelliSense support in C # for version information of a property.

IntelliSenseCSharp  

Updated Wiki: Documentation

$
0
0

Why NetOffice?                                                                 english |deutsch|русский

The usual methods for accessing Microsoft Office. NET are the Primary InteropAssemblies and VSTO. Both access methods involve various disadvantages.

  • They are limited to a version, i.e. they only work with one or certain versions of Office 
  • They cause problems while transferring or installation on other systems 
  • They offer no protection mechanism in the management of COM proxies

NetOffice eliminates these disadvantages and remains a 1:1 wrapper that is syntactically and semantically identical to the interop assemblies. 


How does NetOffice work? 

NetOffice used to access only LateBinding Calls via COM Interop, but without sacrificing the convenience and simplicity of EarlyBind calls. The slim architecture and efficient design makes this only slightly slower than so-called EarlyBind calls in .NET (max. 10%). Events in NetOffice are implemented with a technique the author calls Dynamic EarlyBinding. Learn more about this in the technical documentation

  

NetOffice contains 16 assemblies. Why and which assemblies do I need for my desired Office application? 

All Office applications use types which are defined in other components/type libraries. These dependent type libraries are therefore given as an independent assembly. Each assembly also requires the NetOffice.dll assembly.  An overview which Office application integrates which additional assemblies can be found here. 

Deployment Table:

Office applicationsDependencies
ExcelApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
WordApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
OutlookApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
PowerPointApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
AccessApi.dll 
 OfficeApi.dll
 DAOApi.dll
 VBIDEApi.dll
 ADODBApi.dll
 OWC10Api.dll
 MSDATASRCApi.dll
 MSComctlLibApi.dll
 NetOffice.dll
  
MSProjectApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 MSHTMLApi.dll
 NetOffice.dll
  
VisioApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
MSFormsApi.dll 
 VisioApi.dll
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll

 

What do I have to do to deliver my application with NetOffice?

Nothing except copying the needed assemblies to the target system. You don't need a registration or something like that with the exception of COMAddIns. Managed COMAddins generally have to be registered via the .Net Utility RegAsm.exe or the Windows Installer do that or you.


Do COMAddins also work version independent?

Yes, of course. This is a particular strength of NetOffice. See the code examples for example project for all Office applications but you have to create 2 Addins for 32/64 Bit support.


Is NetOffice ready for multiple platforms(32/64 Bit)?

You can use the NetOffice AnyCPU assemblies in all scenarios. his is true regardless wether you develop for a 32Bit Office application or a 64Bit Office application, even independent on which platform these are installed. If your assembly is a standalone application (.exe) or is being loaded by one, you can compile your assembly as AnyCPU without worries.

If your assembly is a COMAddin that  is being loaded by a 32Bit Office application, you can still compile it as AnyCPU. If you develop a COMAddin that is being used by a 64Bit Office application, you have to compile your assembly as x64. If you wart to support 32Bit and 64Bit Office applications, you may need to provide a second x64-compiled COMAddin. This behaviour is the same in all scenarios(interop,vsto or netoffice). A 64Bit application can only load 64Bit Dll's.If you use a 64Bit Office for testing on your development system and you want to register your COMAddin while compiling (Register for COM Interop), you need to keep in mind that some older versions of Visual Studio call the 32Bit registration in that case. In this case, you get the following error:

"File <path to assembly> is not a valid assembly".
You can read a workarround by Microsoft here:
http://support.microsoft.com/kb/956933


How do I migrate my solution to NetOffice?

Interop Solutions: Change the references and the using(imports in vb) statements. Occasionally, you need to make some adjustments to event triggers. You have to replace all Marshall.ReleaseComObject calls with Dispose. you can also delete the most ReleaseComObject calls because NetOffice manages COM proxies for you. Read more about in the technical documentation:
Understanding COM Proxy Management

VBA Solutions: Developers there want changing a VBA solution to VB.NET and NetOffice has to know that VB.NET is syntactical similar to VBA but has also some different concepts. If you have good VB.NET skills then you have no problems to migrate your solution to NetOffice.

 
COM proxy management

If you call Office applications (COM servers) .NET returns instead of real objects so-called COM proxies. In order to signal the COM server that you no longer need this, you have to free it with a special method. This applies to VSTO as well as to interop assemblies.

Due to this fact, you must not use no objects implicitly or use Enumerator directly because it then can no longer be released. In NetOffice each object provides the method Dispose() for when you do not need it anymore. All classes in NetOffice implement the IDisposable interface and also provide the Dispose() method. However, you do not have to call Dispose() for every used object and you may also use objects implicitly and Enumerator directly without having to worry about releasing ti afterwards. NetOffice generated proxies stored in a separate table and frees when you request it or a parent object is being released. More on that in the technical documentation and Tutorial01.


Unknown and Variant Types

Many office applications include Properties, return values ​​or parameter whose type is not known at design time and which can change at run time, depending on context. There is a difference between unknown COM proxies and the variant data type which has its roots in the Visual Basic for Applications (VBA).

Unknown COM proxies in NetOffice have the type COMObject. Each class in NetOffice also inherits from this type. The declaration of unkown proxies isObject since NetOffice 1.5.1 as special service for VB developers to use the integrated late binding feature. You can also convert an anonymous COM proxy at run-time into the actual type without problems. 

The variant data type is used in VBA for any type to accept both a COM proxy and a scalar data type such as bool or int. In NetOffice that type is replaced by the type object. If a Variant Property is a COM proxy at run time you get an object of the corresponding NetOffice wrapper class, otherwise the the corresponding scalar data type.
More on that in thetechnical documentation andTutorial06.

 
If NetOffice supports all versions of Office, how do I know which Office version offerswhich functionality?

All classes, properties, methods, enums, etc. come with XML Documentation and have a special attribute that identifies which office version(s)  this entity support. You get this information displayed during development also through IntelliSense. Moreover, it is possible to examine an assembly (created with NetOffice) withNetOffice.DeveloperToolbox which Office versions are used practically. Use this opportunity before shipping your assembly to make sure that your program works with the Office versions that you (or your customers) have specified. 

Screenshot: IntelliSense support in C # for version information of a property.

IntelliSenseCSharp  


Updated Wiki: Documentation

$
0
0

Why NetOffice?                                                                 english |deutsch|русский

The usual methods for accessing Microsoft Office. NET are the Primary InteropAssemblies and VSTO. Both access methods involve various disadvantages.

  • They are limited to a version, i.e. they only work with one or certain versions of Office 
  • They cause problems while transferring or installation on other systems 
  • They offer no protection mechanism in the management of COM proxies

NetOffice eliminates these disadvantages and remains a 1:1 wrapper that is syntactically and semantically identical to the interop assemblies. 


How does NetOffice work? 

NetOffice used to access only LateBinding Calls via COM Interop, but without sacrificing the convenience and simplicity of EarlyBind calls. The slim architecture and efficient design makes this only slightly slower than so-called EarlyBind calls in .NET (max. 10%). Events in NetOffice are implemented with a technique the author calls Dynamic EarlyBinding. Learn more about this in the technical documentation

  

NetOffice contains a number of assemblies. Why and which assemblies do I need for my desired Office application? 

All Office applications use types which are defined in other components/type libraries. These dependent type libraries are therefore given as an independent assembly. Each assembly also requires the NetOffice.dll assembly.  An overview which Office application integrates which additional assemblies can be found here. 

Deployment Table:

Office applicationsDependencies
ExcelApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
WordApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
OutlookApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
PowerPointApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
AccessApi.dll 
 OfficeApi.dll
 DAOApi.dll
 VBIDEApi.dll
 ADODBApi.dll
 OWC10Api.dll
 MSDATASRCApi.dll
 MSComctlLibApi.dll
 NetOffice.dll
  
MSProjectApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 MSHTMLApi.dll
 NetOffice.dll
  
VisioApi.dll 
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll
  
MSFormsApi.dll 
 VisioApi.dll
 OfficeApi.dll
 VBIDEApi.dll
 NetOffice.dll

 

What do I have to do to deliver my application with NetOffice?

Nothing except copying the needed assemblies to the target system. You don't need a registration or something like that with the exception of COMAddIns. Managed COMAddins generally have to be registered via the .Net Utility RegAsm.exe or the Windows Installer do that or you.


Do COMAddins also work version independent?

Yes, of course. This is a particular strength of NetOffice. See the code examples for example project for all Office applications but you have to create 2 Addins for 32/64 Bit support.


Is NetOffice ready for multiple platforms (32/64 Bit)?

You can use the NetOffice AnyCPU assemblies in all scenarios. his is true regardless wether you develop for a 32Bit Office application or a 64Bit Office application, even independent on which platform these are installed. If your assembly is a standalone application (.exe) or is being loaded by one, you can compile your assembly as AnyCPU without worries.

If your assembly is a COMAddin that is being loaded by a 32Bit Office application, you can still compile it as AnyCPU. If you develop a COMAddin that is being used by a 64Bit Office application, you have to compile your assembly as x64. If you wart to support 32Bit and 64Bit Office applications, you may need to provide a second x64-compiled COMAddin. This behaviour is the same in all scenarios(interop,vsto or netoffice). A 64Bit application can only load 64Bit Dll's.If you use a 64Bit Office for testing on your development system and you want to register your COMAddin while compiling (Register for COM Interop), you need to keep in mind that some older versions of Visual Studio call the 32Bit registration in that case. In this case, you get the following error:

"File <path to assembly> is not a valid assembly".
You can read a workarround by Microsoft here:
http://support.microsoft.com/kb/956933


How do I migrate my solution to NetOffice?

Interop Solutions: Change the references and the using(imports in vb) statements. Occasionally, you need to make some adjustments to event triggers. You have to replace all Marshall.ReleaseComObject calls with Dispose. you can also delete the most ReleaseComObject calls because NetOffice manages COM proxies for you. Read more about in the technical documentation:
Understanding COM Proxy Management

VBA Solutions: Developers there want changing a VBA solution to VB.NET and NetOffice has to know that VB.NET is syntactical similar to VBA but has also some different concepts. If you have good VB.NET skills then you have no problems to migrate your solution to NetOffice.

 
COM proxy management

If you call Office applications (COM servers) .NET returns instead of real objects so-called COM proxies. In order to signal the COM server that you no longer need this, you have to free it with a special method. This applies to VSTO as well as to interop assemblies.

Due to this fact, you must not use no objects implicitly or use Enumerator directly because it then can no longer be released. In NetOffice each object provides the method Dispose() for when you do not need it anymore. All classes in NetOffice implement the IDisposable interface and also provide the Dispose() method. However, you do not have to call Dispose() for every used object and you may also use objects implicitly and Enumerator directly without having to worry about releasing ti afterwards. NetOffice generated proxies stored in a separate table and frees when you request it or a parent object is being released. More on that in the technical documentation and Tutorial01.


Unknown and Variant Types

Many office applications include Properties, return values ​​or parameter whose type is not known at design time and which can change at run time, depending on context. There is a difference between unknown COM proxies and the variant data type which has its roots in the Visual Basic for Applications (VBA).

Unknown COM proxies in NetOffice have the type COMObject. Each class in NetOffice also inherits from this type. The declaration of unkown proxies isObject since NetOffice 1.5.1 as special service for VB developers to use the integrated late binding feature. You can also convert an anonymous COM proxy at run-time into the actual type without problems. 

The variant data type is used in VBA for any type to accept both a COM proxy and a scalar data type such as bool or int. In NetOffice that type is replaced by the type object. If a Variant Property is a COM proxy at run time you get an object of the corresponding NetOffice wrapper class, otherwise the the corresponding scalar data type.
More on that in thetechnical documentation andTutorial06.

 
If NetOffice supports all versions of Office, how do I know which Office version offerswhich functionality?

All classes, properties, methods, enums, etc. come with XML Documentation and have a special attribute that identifies which office version(s)  this entity support. You get this information displayed during development also through IntelliSense. Moreover, it is possible to examine an assembly (created with NetOffice) withNetOffice.DeveloperToolbox which Office versions are used practically. Use this opportunity before shipping your assembly to make sure that your program works with the Office versions that you (or your customers) have specified. 

Screenshot: IntelliSense support in C # for version information of a property.

IntelliSenseCSharp  

Updated Wiki: Home

$
0
0
NetOffice offers solutions for Office Developers in .NET                      Select a Language:
                                                                                                                       english | deutsch | russian

.NET Wrapper Assemblies for accessing the following MS Office applications:

  • Office, Excel, Word, Outlook, PowerPoint, Access, Project, Visio

Features

  • Office integration without version limitations
  • All features of the Office versions 2000, 2002, 2003, 2007, 2010, 2013 are included
  • Active support in version independent development (please scroll down)
  • Syntactically and semantically identical to the Microsoft Interop Assemblies
  • No training if you already know the Office object model, use your existing PIA code
  • Reduced and more readable code with automatic management of COM proxies
  • Usable with .NET version 2.0 or higher
  • Easy Addin Development 
  • No deployment hurdles, no registration
  • No dependencies, no interop assemblies, no need for VSTO
  • Visual Studio Project Templates and Wizards availablePhoto Gallery


Visual Basic and C# Example Code Online

1Tutorials currently under construction for Release 1.5
2Excel
3Word
4Outlook
5PowerPoint
6Access
7Misc

An indispensablehelper

  • How compatible is your solution with all the office versions ? 
  • You are not sure if your Addin is already loaded?      

      TheNetOffice Developer Toolbox helps you.

 
ToolboxThumb

 Active support in version independent developement

  • XML source documentation for information which version are offering the particular entity
  • check at runtime your specified entity is available in current version (Tutorial 08C#VB
  • check your solution with the Toolbox which Office version are compatible with your code


Documentation and FAQ

1Why NetOffice?
2How does NetOffice work?
3Which NetOffice assemblies do I need for my desired Office application?
4What do I have to do to deliver my application with NetOffice?
5Do COMAddins also work version independent?
6NetOffice is ready for multiple platforms(32/64 Bit)?
7How do I migrate my solution to NetOffice?
8COM proxy management
9Unknown and Variant Types
10How do I know which Office version offers which functionality?


Technical Documentation and Resources

1Technical Documentation (Reference, Performance) under construction
2Technical FAQ
3NetOffice.DeveloperToolbox
4Visual Studio Project Wizard


Roadmap

1NetOffice.DeveloperToolbox Done!
2Extended Linq Support
3Support Microsoft Exchange, Microsoft Visio, Microsoft Project completly
4Enumerators for collections without native enumerator support Done!
5Additional overloads for methods with optional parameters Done!
6FxCop approved Sourcecode
7Visual UI designer


Questions or Comments?

1E-Mail
2Disscusion Board
3Sebastians Blog about NetOffice
Stay informed

follow


Follow NetOffice on Twitter for actual infos about updates and issues

New Post: Deploy NetOffice Word COM Addin

$
0
0
I read the misc postings etc on deploying a NetOffice Com addin and I am still not clear on it. I decided to write an Inno script to do it since I am familiar with it and it is fairly easy. I haven't tested it yet but for those that have deployed one can you look this over to see if I am on the right track. I commented out the icon stuff. I don't think I'll add a special icon.

[Setup]
AppName=TripNO
AppVerName=v1.0
DefaultDirName={pf}\TripNO
DefaultGroupName=TripNO
UninstallDisplayIcon={app}\TripNO
OutputDir=setup
OutputBaseFilename=TripNO_v1.0_setup

[Code]

[Tasks]
;Name: "desktopicon"; Description: "Create a &desktop TripNO icon"; GroupDescription: "Additional icons:"; Flags: unchecked
;Name: "quicklaunchicon"; Description: "Create a &Quick Launch TripNO icon"; GroupDescription: "Additional icons:"; Flags: unchecked

[Files]
Source: "bin\Debug\NetOffice.dll"; DestDir: "{app}";  
Source: "bin\Debug\NetOffice.xml"; DestDir: "{app}"; 
Source: "bin\Debug\OfficeApi.dll"; DestDir: "{app}"; 
Source: "bin\Debug\OfficeApi.xml"; DestDir: "{app}"; 
Source: "bin\Debug\stdole.dll"; DestDir: "{app}"; 
Source: "bin\Debug\Trip.dll"; DestDir: "{app}"; 
Source: "bin\Debug\Trip.pdb"; DestDir: "{app}"; 
Source: "bin\Debug\Trip.tlb"; DestDir: "{app}"; 
Source: "bin\Debug\VBIDEApi.dll"; DestDir: "{app}"; 
Source: "bin\Debug\VBIDEApi.xml"; DestDir: "{app}"; 
Source: "bin\Debug\WordApi.dll"; DestDir: "{app}"; 
Source: "bin\Debug\WordApi.xml"; DestDir: "{app}";  
;Source: "tripNO.ico"; DestDir: "{app}"; 

[Run]
;Unregister
Filename: """C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe"" ""{app}\Trip.dll"" /tlb:Trip.tlb /codebase /u";  
;Register  
Filename: """C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe"" ""{app}\Trip.dll"" /tlb:Trip.tlb /codebase"; 

[Registry]


[Icons]
;Name: "{group}\TripNO"; Filename: "{pf}\Microsoft Office\OFFICE14\winword.exe"; Check: FileExists(ExpandConstant('{pf}\Microsoft Office\OFFICE14\winword.exe')); IconFilename: "{app}\tripNO.ico"
;Name: "{commondesktop}\TripNO"; Filename: "{pf}\Microsoft Office\OFFICE14\winword.exe"; Check: FileExists(ExpandConstant('{pf}\Microsoft Office\OFFICE14\winword.exe')); IconFilename: "{app}\tripNO.ico"; Tasks: desktopicon
;Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\TripNO";  Filename: "{pf}\Microsoft Office\OFFICE14\winword.exe"; Check: FileExists(ExpandConstant('{pf}\Microsoft Office\OFFICE14\winword.exe')); IconFilename: "{app}\tripNO.ico"; Tasks: quicklaunchicon

New Post: SPREEDSHEET IN BROWSER

$
0
0
Hi,

Can I use NetOffice - MS Office to show, edit and save a spreedshet in browser like Google Drive? Where can I find a example or a howto?

New Post: Character Length for Excel

$
0
0
Is it possible to insert a string longer than 255 in excel 2003? The max needed is 500. Thanks.
Viewing all 1741 articles
Browse latest View live


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