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

Commented Unassigned: WordAPI, Selection.Goto wdGoToBookmark Error [20643]

$
0
0
In WordAPI for jumping to then next bookmark "Firstline" in a document, I've tried to use
Application.Selection.Goto(What:=wdGoToBookmark, Name:="Firstline")

but got the error: "For parameter "which" the argument ist missed".

For the argument wdGoToBookmark only the parameter "name" is required, in Word interopts, this is functional but nut in NetOffice, WordAPI.

I found no way, to fix this.
Any Ideas?

Thanks
Joerg
Comments: ** Comment from web user: vanderr3 **

The use of Bookmarks in WordAPI does not seem to follow Word API, Try using Bookmarks.Item, it does not exist, nor can one fine a way to use predefined bookmarks.

If anyone could shed some light on this?

Thanks
Rudy


New Post: NetOffice for Dynamics

$
0
0
Sebastian--you're awesome. Thanks! I've been looking, but so far, I don't see any type of developer edition. Our team is currently using a legal but free copy with our BizSpark license, but it's not something that I'm authorized to give out. I'll let you know if I see anything else; or if you see something, please let me know.

Thanks,

Created Unassigned: An extra "CodeBase" registry value for COM Addin [21224]

$
0
0
When I use NetOffice to creates an Excel COM Addin whose assembly version is not 1.0.0.0 and registers it using RegAsm.exe with /codebase option, an extra "CodeBase" registry value is created under a (non-exisitng) assembly version 1.0.0.0. When unregistering it using RegAsm /unregister, the registry entries for the version 1.0.0.0 is left unremoved in the registry.

RegAsm creates a set of correct registry entries for the Assembly's correct version, as well as an extra entry for 1.0.0.0, so the registered COM Addin works. Also, unremoved registry entries do nothing critical (except for slightly wasting the registry.) So, this is a relatively minor issue.

REPRODUCTION STEPS

1. Run NetOffice Developer Toolbox, choose VS Project Wizard, then create an Automation Addin project for Excel.
2. Open the generated project with Visual Studio.
3. Open the property page for MyAssembly project, choose Application tab, click on Assembly Information..., then change the Assembly version to, say, 1.2.3.4.
4. On Build tab, uncheck "Register for COM interop" so that VS doesn't update the registry.
5. Build the solution to create MyAssembly.dll.
6. Open an Administrator Command Prompt, cd to the directory where MyAssembly.dll resides, and run regasm MyAssembly.dll /codebase
7. Run RegEdit and examine the entries below the COM Addin's CLSID.

OBSERVED BEHAVIOUR

Below the InprocServer32 registry key, I see two subkeys: 1.0.0.0 and 1.2.3.4. Below 1.0.0.0 there is a registry value "CodeBase". (Registry values below 1.2.3.4 are fine, BTW.)

See the attached .reg file for details. Lines 18 and 19 are unwanted. (I'm on 64 bit Windows and developing a 32 bit addin, so the registry keys are below Wow6432Node.)

EXPECTED BEHAVIOUR

Below the InprocServer32 registry key, I see only one subkey 1.2.3.4.

GUESSED CAUSE

NetOffice.ExcelApi.Tools.COMAddin.RegisterFunction(Type) contains a code to add a "CodeBase", which I suspect is misbehaving. (Although I'm not sure it is really the cause of the issue nor what is the intended purpose of the code...)

ENVIRONMENT

Windows 7 (64 bit), .NET Framework 4.0, Visual Studio 2013 Express, NetOffice 1.6, Toolbox 1.2.

New Post: First steps with NetOffice

$
0
0
I'm a VB.NET amateur programmer, and I'm developing a new application to help my coworkers and myself in my job. It involves things like opening and saving documents, searching and replacing within its contents, and reading, creating and sending e-mails automatically

I'm already able to deal with Word.Application and Outlook.Application in late-bound fashion, and even was able to listen to some of Word's events, using things I learned in this site.
But a similar event listener didn't work for Outlook, and, to speak frankly, building my own wrapper for late-bound Office Applications lays far beyond my rookie abilities.

Therefore, I would like very much to use NetOffice in my project (namely for Word), however when I reference the dlls, all I have is some namespaces, including one named WordApi, but I can't find a Word class which I can instantiate and run my code against its members.

I don't know if I'm doing something wrong. I tried to reference the DLLs directly in VS2010Express (which is the one I normally use), and tried it also using NuGet with VS2013Express, with the same results.

What would it take, in very simple terms, to embed NetOffice assemblies inside a VB Windows Forms project, and use the code I already have for things like opening and saving documents, searching and replacing within its contents, and reading, creating and sending e-mails automatically?

Thank you already for any help anyone can offer me.

New Post: Any issue when I reference Excel Object Model in a separate thread?

$
0
0
My addin has a refresh all button. When it is clicked, I will look through worksheet and look for methods (defined in my addin) and refresh data for all these methods, this is done in a separate thread, now in main thread, I show a modal dialog window with "Cancel" button on it.
When refresh is done, the modal window closes.
Everything works fine.
Except when I close Excel, Excel.exe stays in task manage.
http://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects
I think maybe at least one member of a COM object is not released
So I track down my refresh method on the separate thread, the proxy count when entering the method and exiting are the same. So I guess there is no memory leak and all COM object are released properly. but I do not understand why Excel.exe stays

Sorry not sure if I make it clear

Thanks

New Post: Any issue when I reference Excel Object Model in a separate thread?

$
0
0
Here is code I have
public partial class XLWindow : Window
{
    public XLWindow()
    {
        InitializeComponent();
    } 
    private void UserControlLoaded(object sender, RoutedEventArgs e)
    {
        model = DataContext as MainViewModel;
        if (model != null)
        {
            if(RefreshTrehad != null && RefreshTrehad.IsAlive) 
            {
                RefreshTrehad.Abort();  //only allow one refresh thread at a time
                RefreshTrehad = null;
            }
            RefreshTrehad = new Thread(
                () =>
                {
                    if (model.RefreshMode == Helper.RefreshMode.RefreshOneWorkbook)
                    {
                        model.RefreshAll(this);
                    }
                    else if (model.RefreshMode == Helper.RefreshMode.Refresh)
                    {
                         model.Refresh(this);
                    }
                }
            );
            RefreshTrehad.Start();
        }
    }

    private void DoRefreshWork(MainViewModel model)
    {
        //loop through each worksheet, find method,  call web service to get data asychronously
        //when data comes back, plot data in Excel
    }
}


        //call refresh 
        private void RefreshAll()
        {
                var mainVM = MainViewModel;
                var xlWindow = new XLWindow();                  
                xlWindow.DataContext = mainVM;
                bool? successNullable = xlWindow.ShowDialog();
                RefreshTrehad.Join();
                mainVM.Dispose();
        }       

        public class MainViewModel
        {
            ....
            public void Dispose()
            {            
                if (Cells != null) Cells.Dispose();
                if (Rng != null) Rng.Dispose();
                if (Sheet != null) Sheet.Dispose();
                if (Sheets != null) Sheets.Dispose();
                if (Workbook!=null) Workbook.Dispose();
                if (Workbooks != null) Workbooks.Dispose();
                XLApp = null;
            }
        }

New Post: How to force to open an file in specific version of EXCEL

$
0
0
Hi all

I have a PC with Windows Vista Pro, Visual Studio 2008, with both Office 2007 and 2003 installed.
I have defined excel 2007 to open by default xls, xlsx and xlsm files.


Im testing net office to open excel.xlsm files and execute its macros.

I have a excel.xlsm 2007 file with a simple macro which display just a message.


When execute my app, it opens the xlsm file and display message without problem.

The problem is that file was open in excel 2003.


How can i force to open it in excel 2007?


Thanks in advance.

New Post: First steps with NetOffice

$
0
0
In other (and simpler) words, how do I get to have the Word.Application, Excel.Application and Outlook.Application classes available in my project?
Which steps should I take from, let's say, if I had an empty Windows Form Aplication with one form and three buttons, and wanted each one of them to start a new instance of each of those three applications?
If someone can help me with that, I whink I can walk my further way alone. Thank you very much!

New Post: Any issue when I reference Excel Object Model in a separate thread?

New Post: PowerPoint API a few questions (about alignement)

$
0
0
Hello,
I have been searching for 2 days, but found now answer.
I am adding a simple picture to my slide like this:
Shape ss = sl.Shapes.AddPicture(file,MsoTriState.msoCTrue,MsoTriState.msoCTrue,0,0);
how do I set the alignment of the picture inside the slide?
I want it to align center and middle (vertically/horizontally)

Also, a side question, how can I set the text color/background color of a textbox. I set the font name, size but I can't set the font color/background color:
Shape ss2 = sl.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 200, 200);
                            ss2.TextFrame.TextRange.Text = lst[i].Subtitle;
                            ss2.TextFrame.TextRange.Font.Name = lst[i].text_font.Name;
                            ss2.TextFrame.TextRange.Font.Size = lst[i].text_font.Size;
                            ss2.TextFrame.AutoSize = PpAutoSize.ppAutoSizeShapeToFitText;
                            ss2.TextFrame.TextRange.ParagraphFormat.Alignment = PpParagraphAlignment.ppAlignCenter;
                            ss2.TextFrame.TextRange.ParagraphFormat.BaseLineAlignment = PpBaselineAlignment.ppBaselineAlignCenter;
Thanks!
Vlad

New Post: Is shared add-in possible?

$
0
0
Is it possible to develop an add-in that can work with multiple office products? For example single add-in for Outlook , Excel , Word and PowerPoint.

Reviewed: NetOffice 1.6.0 (Aug 25, 2014)

$
0
0
Rated 5 Stars (out of 5) - Excellent work! This framework fulfills its promise and provides a better alternative to VSTO in most cases. Support for workbook level add-in and Ribbon designer can make it even more useful.

New Post: Is shared add-in possible?

$
0
0
Of course its possible.

You can find an example in the download package: "\Examples\Misc\C#\COMAddin Examples" called "Super Addin".
This sample Addin works in Excel, Word, PowerPoint, Outlook, Access and MSProject.

The solution contains 2 projects:

1) The known Shared-Addin way
2) Using the NO Tools layer

*Sebastian

New Post: debugging NetOffice.ExcelApi.Worksheet in VS2010 causes Outlook Wizard to start

$
0
0
I swear. Seen this happen 10 times today.

Code:
protected virtual void WorkbookSheetActivate(NetOffice.COMObject sheetObj) 
{
  try
    {
      if (_sheetTaskPanes == null || sheetObj is Excel.Chart)     
So I hover over sheetObj and expand it, then expand the base and the base of that. Then I scroll down to ListObjects and EVERY TIME it causes Outlook to open. Since I don't have Outlook configured but do have it installed, it starts with the wizard.

Any suggestions here? This is just weird weird behavior but it's super annoying.

New Post: Multiple fonts in a single Word Table Cell (C#)

$
0
0
I've seen a lot of VB examples where you specify a start and length to a range of a Word table cell, but how do you do that in C#? So far I have been able to edit the font in a cell but only 1 character at a time which gets really slow with a lot of text.

This works setting "position" in a little for loop but I'm sure is wildly inefficient not setting a whole range at a time:
table.Cell(row, column).Range.Characters[position].Font.Size = 10;
table.Cell(row, column).Range.Characters[position].Font.Bold = 1;
table.Cell(row, column).Range.Characters[position].Font.Italic = 0;
Thanks!

New Post: Few errors in VS Express and SharpDevelop

$
0
0
Hello,

I have the can't find "extensibility" problem too, on both VS 2013 express and sharpdevelop 4.4
When I go to the list of references, it can find everything else except "extensibility".

Where can I find this reference?

Thank you!

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: ecksteid **

This happened to me too using Windows 7, but it was an easy fix.

The problem is that the zip file comes from the internet, so Windows 7 tags everything as "blocked" until you unblock it. You don't want to unzip the files first or you will have to manually unblock each file.

The trick is to unblock the downloaded zip file first, which unblocks everything inside.

To unblock, right-click the zip file, choose properties, then click "Unblock" at the bottom.

New Post: Hello World or install instructions

$
0
0
Hi,
I have previously used VSTO but would like to move to NetOffice as it looks great!
However I am stumped at the first hurdle, I cannot find any documentation on how to get it working with VS 2013 express.
I have downloaded the tools because it said it would setup the project but it errors in another language every time I try and start it
Das Programm wird beendet - An attempt was made to load an assembly from a network location which would have cause 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 Dang
I assume the message in cut off part way and Dang = Dangerous.
All I did was unzip and double click on exe, is there other things to do first?

Cheers

New Post: Hello World or install instructions

$
0
0
Solved myself, followed the link through to the MS doc and it said the following:
If an application has been copied from the web, it is flagged by Windows as being a web application, even if it resides on the local computer. You can change that designation by changing the file properties, or you can use the <loadFromRemoteSources> element to grant the assembly full trust. As an alternative, you can use the UnsafeLoadFrom method to load a local assembly that the operating system has flagged as having been loaded from the web.
So I unblocked the zip file and extracted it again, is not erroring now.

New Post: Filling in a word template

$
0
0
Hello;
i was seeking some similar solution to get some data from a windows form and insert them in a word template, however, all that office documentations and specifications are too hard to explore.

can i perform that tasks with NetOffice ?
Viewing all 1741 articles
Browse latest View live


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