w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

VSTO Tools: Office 2010 to 2013 upgrade
From the VS menu select: Project Properties Debug Change Start Action to Start external program Enter the address of the Excel.exe Something like C:Program FilesMicrosoft OfficeOffice15EXCEL.EXE

Categories : C#

VSTO Word add-in DLL loading error
So after a day of Googling, I found my solution. It turns out that Word (and Office programs in general) moves your dll's into separate temporary directories - found in: $UserAppDataLocalassemblydl3 My dll depended on other resources in the same directory, but because it was being moved separately into this temporary directory then the dll could not be loaded. To get around this, I loaded the dll manually from the directory that it was installed in using: System.Reflection.Assembly.LoadFile(string path) You can get the directory that it was installed in with these lines of code: System.Reflection.Assembly assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly(); //Location is where the assembly is run from string assemblyLocation = assemblyInfo.Location; //CodeBase is th

Categories : Visual Studio

VSTO: Specify Word Document During Debugging Development
You need to use the command line you can set to run on a successful build (there is no way to only get it to run on Debug (as in F11) and you cannot set it on a per Configuration basis. However, there is a good workaround to get it to only do things on the Debug configuration etc. The basic behaviour is: Open the solution. Open the project's properties. Go to Build Events. In Post-Build Event Command Line enter in the path to Word (e.g. "C:Program Files (x86)Microsoft OfficeOffice14Winword") (or if it is in your %Path% then just Winword) and pass in the path to the document you want opened as an argument. This will open Word and the document on every successful build (you can set the trigger to being all builds, whether successful or otherwise etc) What I prefer to do, however, is simpl

Categories : Vba

How to Create and Insert a MergeField into a Word Document when Developing a AddIn Using VSTO
This is how you insert merge field object objType = Word.WdFieldType.wdFieldMergeField; object objFieldName = fieldName; Word.Field field = range.Fields.Add(range, ref objType, ref objFieldName, ref missing); To replace the text you can either for String.Replace in C# or Find object from Word Object Model.

Categories : C#

Excel 2013 worksheet activate
Sub Macro1() Sheets("Sheet2").Select End Sub Sub Macro2() Unload Me Call Macro1 End Sub This works. I could reproduce your error to an extent, but it may be the location of your macros? (modules vs sheets). EDIT: I didn't see your comment at first, I have Excel2010 (which is why I couldn't really reproduce it). -Sorry

Categories : Excel

ActiveQt: Activate an already open word document
I found the solution to my problem, by using the setControl function with the UUID for word I was able to access a word document that was already opened. QAxObject* wordApplication; QAxObject* doc; wordApplication = new QAxObject(this); wordApplication->setControl(("{000209FF-0000-0000-C000-000000000046}&")); doc = wordApplication->querySubObject("Documents()","my.doc");

Categories : C++

Activate screen when hitting enter C#
You are assigning the KeyDown-EventHandler everytime your text changes: private void textBox2_TextChanged(object sender, EventArgs e) { textBox2.KeyDown += new KeyEventHandler(textBox2_KeyDown); // EVIL! } This means, that the more often you input data into your textbox, the more the eventhandler will be assigned and when you eventually hit enter it will be called as many times. Assign the eventhandler once, i.e. in your constructor and this should work.

Categories : C#

Screen readers: How to make a word with tags surrounding its letters be spoken as a single word, rather than a series of letters?
This not a solution but it might be an useful workaround if your situation allow you. I felt you want to wrap one letter to render that differently, instead you can show the word "test" as an image by doing so you can create it any way you want and put the word "test" as alt attribute in image <h1>This is a <span id="specialWord" ><img src = "testImage.jpg" alt = "test"></span>. </h1> So if it is like that OS X voice over will read it properly. Because if I remember correctly it reads the alt attribute of an image. Now in that case a problem might arise. Anybody want to select it as a text then it would not be possible. You can solve that by calling a javascript function to dynamically change the inner html of the span tag (with id="specialWord" ) to "

Categories : HTML

VBA/VBS Pasting in field not working in Word 2013
I made a workaround which uses selection to paste it in field. Set application = GetObject(, "Word.Application") Function PasteInField(f) Set s = application.Selection 'select all except last char and paste data instead of it f.Result.Select s.SetRange s.Start, s.Start+Len(f.Result.Text)-1 s.Paste 'select last char and remove it f.Result.Select s.SetRange s.End-1, s.End s.Delete end Function It will basically select all but last char, then paste instead, and lastly, remove remaining character. My field is created like this: set field = application.ActiveDocument.Fields.Add(selection.Range, 35, "DEFAULT" , True)

Categories : Vba

How to Disable Save, SaveAs button in MS-Word 2010/2013 using VBA
You can use Workbook_BeforeSave event. http://msdn.microsoft.com/en-us/library/office/ff840057.aspx Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Cancel = True End Sub

Categories : Vba

C# Interop.Word 2013 replacing substring format MULTIPLE TIMES within one line
you need to use for loop.. here is code : int i = 0; int index = text.IndexOf("color", i); while (index > 0) { object oStart = parag.Range.Start + index; object oEnd = parag.Range.Start + index + 4; Range subRange = doc.Range(oStart, oEnd); subRange.Bold = 1; i = index + 4; index = text.IndexOf("color", i); } try this out.......

Categories : C#

Facebook Ads API: is it possible to de-activate and then re-activate an adgroup?
No, there is no way to move from deleted to another state, if you want to pause an adgroup, set its status to paused. it's probably best to pause the entire campaign as there are a few non-obvious quirks with the state model. For example if you pause an ad group in an active campaign, then edit the ad group's other fields, it'll move back to 'active' once the changes are approved by Facebook. In a paused ad campaign, it'll stay paused.

Categories : Facebook

How do you get emacs to word wrap when screen is split
Put this in your initialization file: (setq truncate-partial-width-windows nil) Some background: By default, Emacs switches to line truncation when the window width is less than 50 columns (by default). This is because using line continuation with narrow windows makes the text difficult to read. You can control the number of columns before Emacs switches to line truncation with the truncate-partial-width-windows variable. Setting it to nil means that Emacs will respect what is in your truncate-lines variable.

Categories : Emacs

left click to activate onclick and right click to activate href
You need to differentiate between mouse buttons through the button member of the event object: var left, right; left = mie ? 1 : 0; right = 2; var clickHandler = function (e){ if(e.button === left){ // do onClick stuff and return } else if(e.button === right){ // show your context menu } }, false); But this does look like you could simply have your link as <a href="" onClick="clickHandler">description</a> if I'm not misunderstanding what you want to do.

Categories : Javascript

I want to find the word and replace the 3 word after the search string with my desired word in batch script
You were close. See mods to your code below. If you really want the first word after wordB... this will do it. Don't enable delayed expansion if you don't need it because that just messes you up if there are ! in the text. @echo off SET InFile=test.txt FOR /F "tokens=*" %%A IN ('FINDSTR "wordA" "%InFile%" ^| FINDSTR "wordB"') DO CALL :FindString "%%A" pause goto :eof :FindString SET String=%~1 SET String=%String:*wordA =% SET String=%String:wordB =% FOR /F "tokens=1" %%A IN ('echo.%String%') DO ECHO.%%A :goto :eof

Categories : Batch File

How to loop a MS Word macro applying word by word in a selection?
You can do something like this: Dim myRangeIndex As Range Dim myRangeStart As Range Set myRangeStart = Selection.Range For Each myRangeIndex In myRangeStart.Words() myRangeIndex.Select Selection.MoveLeft Unit:=wdWord, Count:=1 Selection.TypeText Text:="a" Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.Font.Color = -603914241 Selection.Font.Size = 1 Selection.MoveRight Unit:=wdWord, Count:=1 Selection.MoveLeft Unit:=wdWord, Count:=1 Selection.MoveRight Unit:=wdWord, Count:=1 Selection.MoveLeft Unit:=wdCharacter, Count:=1 Selection.TypeText Text:="a" Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.Font.Color = -603914241 Selection.Font.Size = 1 Selection.MoveRight Unit:=wdCharacter, Count

Categories : Vba

Is there any way to change word to another word depends on the condition inside the word?
Not sure exactly what you are after, but here is something: var startvalue = 0; if(MINVALUE > 0) { startvalue = MINVALUE; } Else if(MINVALUE < 0) { startvalue = MAXVALUE; } var result = String.Format(@"CREATE SEQUENCE ""MY_TEST_SEQUENCE"" MINVALUE 8 MAXVALUE 999 INCREMENT BY 1 START WITH {0} CACHE 20 NOORDER NOCYCLE",startvalue) Some more clarification of your question would allow for more useful answers.

Categories : C#

VSTO Background Threading with STA and COM
You can call Thread.SetApartmentState() to select an STA before you start the thread. You must also pump a message loop, a requirement for STA threads. That tends to be difficult and is often skipped, you know you need one if your code deadlocks or your IMessageFilter complains. Beware of the other requirement, an STA is only efficient when you also create the object you want to use on that same thread. That tends to be a problem in a VSTO add-in, you normally want to use an object provided by the Office object model. You don't get to choose where that object was created. If that's accurate at all then you are not ahead with creating your own STA thread since the calls get marshaled anyway. In which case a BGW is just fine since you can't get ahead anyway, the call gets marshaled in

Categories : C#

vba or vsto or .. outlook development
Outlook API is not native .NET framework. To interact it with, .NET relies on marshaling and interrop assembly thus making it much more prone to errors and unstable. From what I've seen so far with my outlook API experience, I would stick with VBA and you should consider retrieving a third party library that exposes outlook extended MAPI if you run in to much of trouble.

Categories : Vba

VSTO - Is it possible to have both designer and XML ribbons?
There is no way to use both Ribbon Designer and Ribbon XML unless you use (2) separate add-ins. The IAddInExtension.CreateRibbonExtensibilityObject is only called once for the life cycle of your add-in. You can either choose to implement the interface using the Designer or the XML route. They are two separate API hooks. The Ribbon Designer is more of a crutch for those new to Office Ribbon development. Once you get familiar with the Ribbon XML approach - it is much simpler and you have much more control over the behaviors (as you indicate in your OP). You can migrate from Ribbon Designer to XML using the Context Menu from the Ribbon Designer surface - although there is some rework for imagery and callbacks because the model is entirely different. It is worth your time to invest in Ribbon

Categories : C#

Javascript date formating Fri Jun 21 00:00:00 UTC+0100 2013 to iso 8601 (2013-06-21)
Use moment.js http://momentjs.com/ moment(new Date(), "YYYY-MM-DD HH:mm Z"); or: var date = moment("Fri Jun 21 00:00:00 UTC+0100 2013"); moment("Fri Jun 21 00:00:00 UTC+0100 2013", "YYYY-MM-DD HH:mm Z"); You can parse it and format it very easily whatever way you want http://momentjs.com/docs/ it is compatible with ISO-8601 dates for parsing as well.

Categories : Javascript

how to change date format in cursor from 'May 4 2013 2:28AM' to '2013-05-04 02:28:34.000'
IMHO, your date variable @date must be a datetime, also variable where you stored the value cursor must be datetime In this way, when you treat these variables you can compare them without problems. About a more complete answer please post your SQL code.

Categories : Sql Server

Excel VSTO Autofilter not working right?
In answer to the second part of your question, getting the number of filtered rows is tricky. rng.Rows.Count will return the original number of rows, not the filtered number. You can use an expression like the following: Evaluate("=SUBTOTAL(3," & Range("A:A").Address & ")-1") which you can store in an integer - you may have to cast the result. 3 represents the COUNTA function (excluding the filtered rows) and I'm subtracting 1 to exclude the header row. Increase this number if there are other occupied cells in the column. You could store this formula temporarily in a cell, but I believe it should return a result using Evaluate(). Added Read rng.SpecialCells(xlCellTypeVisible).Count before and after applying the filter to determine whether the filter worked. There is usef

Categories : C#

Is there a reason to not use "1" class with a small VSTO Add-in?
Project templates should recommend practices which work for most cases, both simple and complex. You can write both simple and complex projects with proper class hierarchy, but only simple projects can be effeciently written without following best practices. That being said, you are not forced to follow any class hierarchy suggested by the project template. If using a single class works the best for you, you can use this approach. There is nothing wrong with choosing simple tools for simple problems. It is in fact a good idea if you make a conscious choice. Preformance-wise, there will not be any considerable differences. It is about programming effeciency, not about execution effeciency.

Categories : C#

VSTO 2012: backward compatibility
As far i know you can deploy your solution to previous version office. I once developed an add-in for ppt 2013 and it worked fine in ppt 2010. Note that The API for the new VSTO has several additional features and last time i only used existing features, but not the new ones. I've never tested this, but i think if you use new event handler that only works in 2013, when you deploy it in 2010 it simply does nothing / doesn't work. As i mentioned, the obvious advantage of new VSTO is more features available, for example in ppt 2013, it has event handler when the users do dragging, you should checked them by yourselves. If your solution doesn't need these new features, you can develop it in the previous version of VSTO to make sure the backward compatibility.

Categories : C#

VSTO 4.0 Outlook AddIn signing
you can make the MSI from vistual studio using "Visual studio installer as a new project" in this wizerd link your project output to the Setup Project and copy the manfiest file manually into the dependencies folder of the Setup(the project you are using to make MSI). then you can run the MSI as silent via Group Policy. dont know if thats help but thats how i am doing currentaly for my project. Thanks

Categories : C#

How to find out if application is busy in VSTO
I think you might want to check out EApplication_PresentationSaveEventHandler, which occurs before any open presentation is saved. Hopefully this would point you to the right direction. You can register this event by using following code snippet: Application.PresentationSave += new EApplication_PresentationSaveEventHandler(Application_PresentationSave);

Categories : C#

Exception and endlessly growing designer generated code in InitializeComponent when using Steema TeeChart for .NET 2013 4.1.2013.05280 - What to do?
Thanks for reporting. I could reproduce the issue and added it (TF02016626) to the defect list to be fixed for next releases. We have found that in VS2012 saving the form (form only, not the complete project) before closing it doesn't produce the exception. Alternatively, the only solution I can think of for now is using Gantt series at run-time, for example: Steema.TeeChart.Styles.Gantt gantt1 = new Steema.TeeChart.Styles.Gantt(tChart1.Chart); gantt1.FillSampleValues();

Categories : C#

Convert String "22/08/2013" to date format 2013/08/22
You need to define a SimpleDateFormat which first parses your string and get Date from it. And then convert it to whatever format. var s:String ="22/08/2013" var simpleDateFormat:SimpleDateFormat = new SimpleDateFormat("dd/mm/yyyy"); var date:Date = simpleDateFormat.parse(s); val ans = new SimpleDateFormat("yyyy/mm/dd").format(date) println(ans)

Categories : Scala

Can't install MS Project 2013 after installing Office 2013
You have to remove all the beta versions of Office 2013. After this I could install Office 2013 and Visio 2013 without any problems and the cause is probably the Prooffing Tools. I had the same issue. Here is small guide to remove Prooffing tools (That are not appearing to appwiz.cpl = system application). Go to %windir%installer Right click titlebar and select subject Go each msi through (Subject value) and you'll find some prooffing tools preview installed. (or something else from preview) Right click it and choose "Uninstall" After that you should be able to install Office 2013 RTM You can also see if this can help you.

Categories : Windows

Simple Example of VSTO Excel using a worksheet as a datasource
So in the Sheet1_Startup event Excel.Range range1 = this.Range["A1", missing]; var obj = range1.Value2.ToString(); You would need to move to the next cell then range1 = this.Range["A2", missing]; obj = New list(range1.Value2.ToString());

Categories : C#

Outlook VSTO C# Make post to html url
You need to use WebRequest / HttpWebRequest class, for example: HttpWebRequest request = HttpWebRequest.Create("http://google.com/postmesmth") as HttpWebRequest; request.Method = WebRequestMethods.Http.Post; request.Host = "google.com"; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0"; string data = "myData=" + HttpUtility.UrlEncode("Hello World!"); StreamWriter writer = new StreamWriter(request.GetRequestStream()); writer.Write(data); writer.Close(); HttpWebResponse response = request.GetResponse() as HttpWebResponse;

Categories : C#

c# : VSTO -> MS Office Apps loosing focus?
If you are launching the form from a different form, you should set that as the Owner of the ColorDialog: if (dlg.ShowDialog(this) == DialogResult.OK) //"this" being the owner form

Categories : C#

How to center a WPF Window in a Excel VSTO addin
I was able to solve this by get getting the Rect of the Main Excel Window using user23 [DllImport("user32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect); [StructLayout(LayoutKind.Sequential)] private struct RECT { public int Left; public int Top; public int Right; public int Bottom; } It appears that Globals.ExcelAddin.Application.ActiveWindow was not giving me back the dimension I expected. I think it was giving me the Ribbon Addin's dimensions and not Excel's Main Window.

Categories : Dotnet

converting txt files to Outlook MailItem in C# VSTO Add-in
What are these files? MIME messages? In that case you can either explicitly parse them and create new Outlook messages, or you can use Redemption to import them into Outlook. In VB: set Session = CreateObject("Redemption.RDOSession") Session.MAPIOBJECT = Application.Session.MAPIOBJECT set Inbox = Session.GetDefaultFolder(olFolderInbox) set Msg = Inbox.Items.Add("IPM.Note") Mg.Sent = true Msg.Import "C:Temp est", 1024 'olRfc822 Msg.Save

Categories : C#

Save an Excel VSTO XSD to disk and persist use with C#
Instead of serializing a DataGridView, why not populate the DataGridView from either a DataTable or from a custom binding list, and then you can serialize either that DataTable or custom binding list?

Categories : C#

ILNumerics and Visual Studio Tools for Office (VSTO)
This is the same issue as here: Ilnumerics Ilpanel not activating when compiled in a winform into a dll when loaded into matlab in-a-winform-into-a-dll-when-loa Using VSTO as host for ILNumerics lets the panels assume, it was loaded in a designer. We are currently collecting possible workarounds and solutions. One solution might be to introduce a flag in the Settings of ILNumerics: Hosted [default: false] Your situation would require the flag to be enabled. In hosted mode, a blacklist of common designers could be checked at runtime and compared to the current entry assembly. Any other suggestions?

Categories : C#

how to find out the number of open sheets in workbook using VSTO
I'm not a C# guy but you should certainly be able to obtain the information you're looking for. So the following examples are VBA but you should have all of the same methods available to you in C#. To clarify as I mentioned in the comments on OP: Excel Workbook only has one ActiveSheet at any given time, and All sheets are "open" when the Workbook is open (but only one of them is the ActiveSheet) To determine how many sheets are in the workbook, use the Count property of the Worksheets collection: w = ActiveWorkbook.Worksheets.Count To determine the name of the active sheet: sName = ActiveWorkbook.ActiveSheet.Name If you have multiple open workbooks, and want to get the name of the active sheet in each of them (this just assigns to a string, but probably I would store them in an

Categories : C#

Excel VSTO persist data entered into a WinForm
Take a look at this CodeProject page, Saving the state (serializing) a Windows Form. I've used it in Excel VSTO applications that incorporated WinForms and it works beautifully. It's also very easy to customize it to include any of your controls that are not already built into the class, as well as change the format of how the control data is saved, etc. In short, you are able to do two calls in your code: FormSerialisor.Serialise(this, myPath + @"myFormName.xml"); and FormSerialisor.Deserialise(this, myPath + @"myFormName.xml"); Very simple and very fast. It's written in C#, but it can be used in VB.Net projects as well by compiling the class and then referencing the .dll

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.