Quantcast
Channel: Visual Studio Tools for Office (VSTO) forum
Viewing all 5157 articles
Browse latest View live

Can I customize Office default SaveDialog or Office.FileDialog[Office.MsoFileDialogType.msoFileDialogSaveAs] ?

$
0
0

Hello.

I make VSTO Excel/Word/Powerpoint AddIn.

I use Office default SaveDialog and Office.FileDialog[Office.MsoFileDialogType.msoFileDialogSaveAs]  

Two Dialogs has differences.

Default dialog has [Author] [Tags] [Title] and [Save thumbnail] , but Office.dialog doesn't.

Can I remove Default dialog's option ?

Can I add option to Office.dialog ?

A.Suzuki 


Outtlok AddIn not visible in Outlook when .msi is run.

$
0
0

I've created this Outlook button AddIn that needs to be displayed on the "Home" tab in Outlook.

Created this and also a setup project to be able to deploy the .msi files on to the client machines.

The issue Im facing is, when the setup project is "Built","Rebuilt" or "Install"ed the button appears in Outlook. If I run the XX.msi file or the setup.exe file, the button doesn't show up on the tab.

My OS is 32 bit and MSOffice is 32 bit as well. I have the registry setting in HKEY_USER. 

Also when I try modifying the prerequisites location to local in the Setup project, the "Build" action throws me a missing dotnetfx3.5Clientprofile.exe error for which I installed the client profile but in vain.

If this is unselected, and the project is built, I again see the AddIn in outlook. So In any case the Build or Install function works.

Any ideas?

Thanks.

VSTO Outlook

$
0
0

Hi,

We are developing outlook Add-Inusing Office.Js. For the security reason we couldn't deploy our Addin in the customer place they blocked the admin center.

So we are developing the Add-In using VSTO outlook but we are facing two issues.

1) In VSTO outlook project I'm referencing the office.JS using the Webbrowser control but office js is not initialized properly so does VSTO support Office.JS?

2) Office JS has callback method to send the token to download the email attachments from the Exchange server We are trying to replace the Office.Js with VSTO outlook add-in but how do I get the token in VSTO outlook to download the email attachments from the Exchange server.

Please help me on this issues.

-Bala

How to go through the items in a msoGroup shape by C# VSTO?

$
0
0

I am writing a VSTO for Word 2010. I want to exam the shapes in a msoGroup shape but failed to get the shapes in the group. Here are my tries:

public void TestGroupShapes_Action(Microsoft.Office.Core.IRibbonControl control)
{
    Microsoft.Office.Interop.Word.Document doc = Globals.ThisAddIn.Application.ActiveDocument;

    foreach(Microsoft.Office.Interop.Word.Shape shape in doc.Shapes)
    {
        if (shape.Type == Microsoft.Office.Core.MsoShapeType.msoGroup)
        {
            /*
            // System.InvalidCastException:
            // Cannot convert System.__ComObject to Microsoft.Office.Interop.Word.Shape”
            foreach (Shape groupShape in shape.GroupItems)
            {
                Console.WriteLine(groupShape.Name);
            }
            */

            for(int i=0; i<shape.GroupItems.Count; i++)
            {
                // System.ArgumentException: Cannot use the index in the assembly.
                Microsoft.Office.Interop.Word.Shape groupShape = shape.GroupItems[i];
                Console.WriteLine(groupShape.Name);
            }
        }
    }
}
How to solve the problem?

重庆有偿捐卵子联系方式

$
0
0
有偿卖卵子联系【微信852020595】卖卵子联系方式,捐卵子联系方式,收卵子联系方式,正规有偿捐卵。补偿1-10万,8-12天完成任务,包吃包住,保姆照顾。

Retrieve all the fonts styles applied(used) for all the cells in an Excel in C# -Vsto

$
0
0

I am new in the .Net world. I am writing an Addin in C#(vsto) for Excel, where I want to read all the fonts styles that are used in every cells in a given the Excel worksheet. The below code works,

List<string> fontsInSheet =newList<string>();Excel.Range usedRange = currentSheet.UsedRange;for(int i =1; i <= usedRange.Rows.Count; i++){for(int j =1; j <= usedRange.Columns.Count; j++){Range excelCellRange = currentSheet.Cells[i, j];if(!(excelCellRange.Font.NameisDBNull)&&(!fontsInSheet.Contains(excelCellRange.Font.Name))){
                        fontsInSheet.Add(excelCellRange.Font.Name);}}}

But the nested for loops are unfortunately too slow if Excel sheets are too big. So, ist there better solution available to retrieve used font styles more efficiently. Thanks in advance.

Differentiate between the custom installed fonts and Office Application built-in(default) fonts in C# vsto

$
0
0

I am new in the .Net world. I am writing an Addin in C#(vsto) for Excel, where I want read out all the font styles available in the given Excel file. I would like to know if the user has any fonts custom installed for the Office Application. The below piece of code helps retrieve all the installed font including both custom installed and default office fonts.

InstalledFontCollection installedFontCollection = new InstalledFontCollection();

FontFamily[] fontFamilies = installedFontCollection.Families;


Could you please let me know if there is anyway to programmatically distinguish between the default Office Application fonts and Custom installed?

Iteration over Excel Worksheet is much slower with Excel 365 than Excel 2013

$
0
0

Hi,

I am reading cell values using my C# application. Using Excel 2013 (64-Bit) this works fast. Using Excel from Office365 32-Bit it is 10 times slower. The code is the same.

What can I do to improve the performance with Office365?

Thanks,
Christian


Link CustomTaskPane textbox value with Excel cell value

$
0
0

In relation to... Visual Studio 2015, VB.net, Excel VSTO Ribbon Addin, Custom Task Panes...

I'm trying to refresh a textbox on a custom task pane created through a vsto ribbon addin.

When a sheet change event occurs I would like the textbox to update its value to the value of a cell.

Basically the textbox should be the same as the cell.

I can't seem to trigger the custom task pane events from outside the custom task pane or even just directly change the textbox value.



MailItem.Parent folder not giving desired folder name in Outlook with Different mail server other than Exchange

$
0
0

Hi,

I am dragging and dropping an email from inbox to my custom folder under inbox. While dragging and dropping email I want to find my destination folder.

I am using the below code.

Outlook.MailItem mailItem =(Outlook.MailItem)item;

Outlook.Folder parentFolder = mailItem.ParentasOutlook.Folder;

This works fine if I have Outlook with Exchange Server. But If have some other mail server(eg. ArgoSoft Mail Server)

it always returns "Inbox" as the folder name.

Is there any way I can get the actual folder name where I am dropping my email from mailItem ?

HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED) error when call ExcelApp.ActiveWorkbook.VBProject.References.Item(i).FullPath

$
0
0

I would like to check the references of the VB project, using FullPath, when I testing it on some pcs, it throw aSystem.Runtime.InteropServices.COMException. Error message is Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)). testing with excel 2016 64 bit. Could anyone help me with it? Thanks in advance!!

PropertyAccessor.GetProperty values in .ics file

$
0
0

I have an app that creates a MeetingItem from an .ics file. I have used OutlookSpy to get to the Definitions of most of the fields that I need to use. However, I still can’t locate the correct definitions for:

X-MICROSOFT-LOCATIONS (which is a JSON string) and
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN= an email address which shows up in Outlook as RequiredAttendees 

Here is the code snippet that I use to open the .ics file (nothing fancy):

Private Const con_PR_START_DATE = "http://schemas.microsoft.com/mapi/proptag/0x00600040" Private Const con_PR_END_DATE = "http://schemas.microsoft.com/mapi/proptag/0x00610040"

Dim objMeeting as Outlook.MeetingItem
Dim objPropAcc as Outlook.PropertyAccessor

objMeeting = mpnNamespace.OpenSharedItem(strTempFilesDir & "\Cal01.ics") Debug.Print($"objMeeting.Subject: {objMeeting.Subject}") objPropAcc = objMeeting.PropertyAccessor Debug.Print($"PR_START_DATE: {CDate(objPropAcc.GetProperty(con_PR_START_DATE)).ToLocalTime}") Debug.Print($"PR_END_DATE: {CDate(objPropAcc.GetProperty(con_PR_END_DATE)).ToLocalTime}")

As you can see, I already have some of the definitions (of Properties) that I need, I just need theX-MICROSOFT-DEFINITIONS (which is how it’s declared in the .ics file), and RequiredAttendees value (which is somehow built from ATTENDEE declaration in the .ics file).

I have searched online for several days in an effort to find the correct KEY (Guid, etc), but cannot find any reference to these properties.

Any assistance would be greatly appreciated.
Thank you for your time in advance.

Sincerely,
Paul Goldstein


Paul D. Goldstein Forceware Systems, Inc.

VSTO Word Add-In causing 45 second load times

$
0
0

I'd appreciate help determining why my Word VSTO Add-In is causing 45 second load times.

The Add-In is used by multiple customers, only one of which experience this issue. I can not reproduce the problem on any of my test environments. (all running Windows 10, Office 365)

Findings:

  • v35 of the Add-In works fine (built back in March).
  • After the customer installs v55 the problem starts (built in July).
  • I've incrementally removed all my code, nuget packages, reference (everything) from the Add-In and the problem persists.
  • I've removed my Add-In and create a new WordAddin1 project. The 45 second problem occurs when this Add-In is installed at the customer.
  • If I rebuild v35 today and run on the customer machine it works fine.
  • I have established that the 45 seconds happens BEFORE my Add-In code get's a chance to run.
  • I have run fuslogvw.exe to determine if any dependencies are causing timeouts (they aren't)
  • I have run performance monitoring to ensure that CPU, Memory, Disk, Network traffic are at acceptable levels (they are)
  • I have run Telerik Fiddler to monitor traffic and can see multiple calls (4) to Windows Update that time out (the customer pushes out updates via SCCM and does not get updates from Windows Update)
  • 2 of those Windows Update calls and timeouts happen when I disable my Add-In and Word opens within 5 seconds.

How can I better understand what Word is doing during that 45 seconds? It's a black box that I can't seem to peer into.

Any help greatly appreciated

Problem publishing my vb project

$
0
0
How to I publish my vb project to be used by client which i created the database in firebase Real time database. 

New to VB - How do I write code to use keyboard shortcuts in PowerPoint?

$
0
0
Looking for resources. Complete noob and links to articles of where to get started would be great. Interested in making a COM add-in. I have no clue how. The end goal is to be able to use keyboard shortcuts to control PowerPoint functions like aligning multiple boxes, making the same size, etc. Wanting to learn how to do this, many articles on Microsoft, but I'm not sure which are the right places to get started

How do I capture the active cell on a Worksheet that is not the Workbook.ActiveSheet?

$
0
0

As I understand it, to capture the active cell is done by accessing:

Workbook.Application.ActiveCell

But how do you capture the active cell on a Worksheet that is not currently active?

Before anyone goes and suggests that there is no "ActiveCell" on a worksheet that is not currently active, I'm going to stop you right there and say that conceptually yes, there is. When you visit a worksheet, select a cell, move to another worksheet, select a cell, and then go back to the original worksheet, your originally selected cell on that worksheet is still selected. THIS is the cell I want. And I want to capture it programatically using VSTO/COM Interop.

Any help would be appreciated.

Microsoft word document Numbering changes after export-import contents of a content control

$
0
0

In my vsto word plugin, for a document I am keeping the history of changes inside content controls. I export the content control range as HTML. The problem occurs with numbering inside document when i want to replace the content control with some previous range html. e.g.

  1. I have 4 content controls(1,2,3,4) with Numerical listing format(1.,2.,3.,4.) against range of content controls. Once I change the 2nd content control at some point with any old html(or just previous one) then the numbering in the document becomes (1.,1.,2.,3.). The numbering starts again from 1.
  2. In above scenario, if i change the 3rd content control. Then the numbering becomes (1.,2.1.,2.).

I am using Range.exportfragement() method for getting the HTML. I tried inserting range with both range.insertfile() and range.importfragement(). Both have same result.

I tried extracting the XML out of the content control -> It gives numbering correctly while inserting again, but if i export as XML then all of the child content controls inside the exported range are gone. Only html export have capability to maintain info about child content controls.

VSTO outlook addin - update UI from background thread and keep outlook responsive

$
0
0
I'm working on an Outlook add-in. After composing a new email, on click of send (ItemSend event handler), add in is uploading attachments to Azure cloud. To track the progress I'm using a progress bar. I'm facing an 2 issues here. Firstly, Progress bar is grey and unresponsive. I don't see the progress at all. Secondly, outlook is completely blocked till upload is finished. But the requirement is, till the upload is in progress, user should be free able to check/send other mails.

Calling method:

 ProgressForm.Show()
//**Syncronization context is not null before calling
      var result = await ProgressForm.UploadFiles(files);

//also tried Task.Run(() =>ProgressForm.UploadFiles(files))
// **Perform action based on result. as of now control doesn't return back here


Below async method uploads files

public async Task<bool> UploadFiles(List<UploadFilesListModel> filesList)
    {
        try
        {
            //**Synchronization context is not null here**
            Print((SynchronizationContext.Current is null) ? "sync context null" : SynchronizationContext.Current.ToString()));

            foreach (var file in filesList)
            {
                //using Microsoft.WindowsAzure.Storage.Blob cloudBlockBlob
                var cloudBlockBlob = new CloudBlockBlob(new Uri(file.Uri));
                int blockSize = 256 * 1024;              
                using (FileStream fileStream = new FileStream(file.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    int blockCount = (int)((float)fileSize / (float)blockSize) + 1;
                    List<string> blockIDs = new List<string>();
                    int blockNum = 0;
                    int bytesRead = 0; 
                    long bytesLeft = fileStream.Length; 

                    while (bytesLeft > 0)
                    {                           
                        blockNum++;
                        int bytesToRead;
                        if (bytesLeft >= blockSize)
                        {                               
                            bytesToRead = blockSize;
                        }
                        else
                        {                              
                            bytesToRead = (int)bytesLeft;
                        }
                        string blockId = GetBlockID(blockNum);
                        blockIDs.Add(blockId);
                        byte[] bytes = new byte[bytesToRead];
                        fileStream.Read(bytes, 0, bytesToRead);
                        string blockHash = MD5Hash(bytes);
                        //upload single block
                        await cloudBlockBlob.PutBlockAsync(blockId, new MemoryStream(bytes), blockHash);
                        bytesRead += bytesToRead;
                        bytesLeft -= bytesToRead;
                      
                        //**update progress bar here**
                        progressBar1.Invoke(updateProgress); 
                       //**also tried using progress.Report(bytesRead); where progress is IProgress<int> but does not work
                    }
                    //**upload all blocks**
                    await cloudBlockBlob.PutBlockListAsync(blockIDs);                        
                }
            }             
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
    }


I'm new to VSTO and async concepts, any leads are appreciated. Thank You


Why can I not add a reference to a project in Visual Studio 2012 and 2015?

$
0
0
In Visual Studio 2015, I create a new project, using the Visual C# > Windows > Console Application template.  (The target framework is the default of .NET Framework 4.5.2, but I do not think that is relevant to the problem.) 

I attempt to add a reference to the project.  In the Solution Explorer, I expand the project, right-click on “References”, and click the “Add Reference…” context menu item, which launches the “Reference Manager” dialog.  In the dialog, under Assemblies> Extensions,  I select the Microsoft.Office.Interop.Excel assembly whose version is 14.0.0.0, and click the OK button.

Nothing happens.  The assembly I selected is not added as a reference to the project.

I have the same problem if I select *any* assembly.  None of them are added as a reference to the project.

I have the same problem if I use Visual Studio 2012.  (The target framework is .NET Framework 4.6.1.)

I do *not* have the problem if I use Visual Studio 2008.  (The target framework is .NET Framework 3.5, and the versions of the assemblies are also older.)  But, at least I can add an assembly as a reference to the project.

What can I possibly be doing wrong in a newly created project that would prevent an assembly from being added as a reference to the project?

VSTO outlook addin - updates to a meeting through the inspector changes its behaviour

$
0
0

I'm working on an Outlook VSTO add-in, installed on Outlook 2016.

The goal of the add-in is that, when working on a meeting/appointment and clicking a button we added to the ribbon, an additional link is added to the item. It then can be sent as usual.

What we discovered is that, once this is done, reopening the appointment from the calendar requires to ctrl+click the link to open it, until we close outlook and reopen it.

Basically, if I:

  • create a new appointment A
  • type a link in the text (ex: http://www.microsoft.com)
  • save the appointment
  • reopen the appointment

=> the link can be accessed by clicking on it

but if I 

  • create a new appointment B
  • type a link in the text (ex: http://www.microsoft.com)
  • click the button to add a second link to the text
  • save the appointment
  • reopen the appointment

=> the link can be accessed by ctrl+clicking on it

If I then close and reopen outlook, and open the appointment B, the click can be accessed bu clicking on it

I reduced the scope of the code to the following:

public void InsertLink(IRibbonControl control)
{
  // Get the appointment that is being send.
    Outlook.Inspector inspector = Globals.MyAddin.Application.ActiveInspector();
    inspector.CurrentItem.Location = "test";
}

I tried a few different ways (Saving it, closing it...) to no avail

Has anyone here any idea on how to slove this?

Viewing all 5157 articles
Browse latest View live


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