Quantcast
Channel: Word for Developers forum
Viewing all 4350 articles
Browse latest View live

Grand Total of Sub Totals in MS-Word Forms

$
0
0

I have made a fillable form in MS-Word. It has fileds like

SubTotal Set1 (Text1+Text2+Text3)

SubTotal Set2 (Text4+Text4+Text6)

I want Grand Total (Set1+Set2)

But it is not correctly calculating SubTotalSet1 and SubTotalSet2 is correctly showing but when I do Grand Total of SubTotal Set1 and SubTotal Set2 it is show incorrectly total. Can anyone help?


Get Open XML for complete document using Javascript API

$
0
0

Hi,

I am creating an add-in for Word using Javascript API.

I am able to get Open Office XML for body using context.document.body.getOoxml();
But I also want to get Open XML for headers and footers.

I can get the Open XML by querying

context.document.sections.getFirst().getHeader("primary") //"firstpage", "evenpage"

As I want open XML from all headers and all footers I need to write six different calls

context.document.sections.getFirst().getHeader("primary")

context.document.sections.getFirst().getHeader("firstPage")

context.document.sections.getFirst().getHeader("evenPages")

context.document.sections.getFirst().getFooter("primary")

context.document.sections.getFirst().getFooter("firstpage")

context.document.sections.getFirst().getFooter("evenPages")But this is very slow(Takes around 20-30 secs to execute)
Is there any way I can get complete OOXML by just making a single call?
Or any other way to make the above approach faster?

Thanks,
Abhijeet

Office Add-in not showing in My Organization and My Add-in. Showing only in Shared Folder.

$
0
0
I am developing Office Add-In for word document. I have published in SharePoint app catalog. My Add-In only showing inShared Folder and not showing in My Organization andMy Add-in. Any expert kindly help me to show Add-In in My Organization and My Add-in

Macro record for find font Batang and replace with Verdana

$
0
0

how to Macro record in Word  for find font Batang and replace with Verdana in the document


Since i tried for record macro to change font but i need to manually select the text and run the FontChangeMacro.

I need like how to automate the fontcheck as Batang and change to Verdana font, instead of select text in word  


R L Kiran

How to make a drop down list in Word 2016 using an Acces database?

$
0
0

I have lots of word-documents (Word 2016) that I shared with my team. Each member can individualize his documents by assigning himself as a point of contact in the document text, using a drop down list.

Each time a new member arrivés at my team, or when someone leaves, I have to adjust the drop down lists in each separate document, which is quite time-consuming.

Therefore I made a unique Acces database containing all teammembers.

How can I refer to this unique database in my drop down list to ensure that each database modification affects each drop down list?

A way to create table with pictures faster?

$
0
0

Hello.

I am looking for help.

I recently started a job that needs me to make a lot of long reports with pictures in Office.

I looked for a way to automatically create a table that put pictures from a file, best thing would be a 2 column table, with 1 empty line under the pictures.

I found this code; witch is handy but doesn't do a table.

Sub InsertMultipleImagesFixed()

 Dim fd As FileDialog

 Dim oTable As Table

 Dim iRow As Integer

 Dim iCol As Integer

 Dim oCell As Range

 Dim i As Long

 Dim sNoDoc As String

 Dim picName As String

 Dim scaleFactor As Long

 Dim max_height As Single

 'define resize constraints

 max_height = 275

 

 'add a 1 row 2 column table to take the images

 Set oTable = Selection.Tables.Add(Selection.Range, 1, 1)

 '+++++++++++++++++++++++++++++++++++++++++++++

 'oTable.AutoFitBehavior (wdAutoFitFixed)

 oTable.Rows.Height = CentimetersToPoints(4)

 oTable.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenter

 '++++++++++++++++++++++++++++++++++++++++++++++

 

 Set fd = Application.FileDialog(msoFileDialogFilePicker)

 With fd

 .Title = "Select image files and click OK"

 .Filters.Add "Images", "*.gif; *.jpg; *.jpeg; *.bmp; *.tif; *.png; *.wmf"

 .FilterIndex = 2

 If .Show = -1 Then

 

 For i = 1 To .SelectedItems.Count

 

 iCol = 1

 iRow = i

 'get filename

 picName = Right(.SelectedItems(i), Len(.SelectedItems(i)) - InStrRev(.SelectedItems(i), "\"))

 'remove extension from filename ****

 picName = Left(picName, InStrRev(picName, ".") - 1)

 

 'select cell

 Set oCell = ActiveDocument.Tables(1).Cell(iRow, iCol).Range

 

 'insert image

 oCell.InlineShapes.AddPicture FileName:= _

 .SelectedItems(i), LinkToFile:=False, _

 SaveWithDocument:=True, Range:=oCell

 

 'resize image

 If oCell.InlineShapes(1).Height > max_height Then

 scale_factor = oCell.InlineShapes(1).ScaleHeight * (max_height / oCell.InlineShapes(1).Height)

 oCell.InlineShapes(1).ScaleHeight = scale_factor

 oCell.InlineShapes(1).ScaleWidth = scale_factor

 End If

 

 'center content

 oCell.ParagraphFormat.Alignment = wdAlignParagraphCenter

 

 'insert caption below image

 oCell.InlineShapes(1).Range.InsertCaption Label:="Figure", TitleAutoText:="", _

 Title:=": " & picName

 If i < .SelectedItems.Count And i Mod 2 = 0 Then 'add another row, more to go

 oTable.Rows.Add

 End If

 Next i

 End If

 End With

 If anyone could help me, it would be nice, I could save a lot of time.

Thanks a lot in advance.

Title bar of Word automation in vb.net not displaying properly

$
0
0

I am automating a mail merge inside a vb.net application (VS2008).   This is working ok except that the title bar of the Word application is cut off a little, and it sometimes gets covered up.   In order to display the Word application inside my VB.net application I am using SetParent to assign to a groupbox named Frame1.

Private oappWord As New Microsoft.Office.Interop.Word.Application
Private oDoc As Microsoft.Office.Interop.Word.Document

oappWord.Caption = "myWord"
oDoc = oappWord.Documents.Add(, , Microsoft.Office.Interop.Word.WdMailMergeMainDocType.wdFormLetters)
lngDocHandle = FindWindow(vbNullString, oDoc.ActiveWindow.Caption & " - " & oappWord.Caption)
oappWord.Caption = CStr(Nothing) 'set caption back

oappWord.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMaximize
SetParent(lngDocHandle, Frame1.Handle.ToInt32)

oappWord.Visible = True

What is happening is that the title bar of the Word application appears as so, with the save, undo, redo icons cut off.  I tried setting oappWord.top with no improvement:

If I then click outside of my groupbox, and hover the mouse over the Word title bar, the Word title bar changes to, and even the min/max/close icons are covered:

So while I can still access the File tab to save, the Save icon is covered up.   Then if I click on various Word tabs, the Title bar again is partially painted.

I don't work with Word automation very much - this is just a feature of our application.   So I'm hoping someone out there can spot what I am doing wrong fairly easily.

Thanks inadvance!


My AddIn (run using the VS 2017 debugger) suddenly stopped loading

$
0
0

When running my AddIn from VisualStudio 2017 it suddenly stopped loading.

I have the registry correctly set:

On start-up Word asks if I want to load, so it is initially loading it:

Word then starts up and no AddIn. Fuslog at this point shows just the first 3 lines in the below screenshot:

I then go in to options to turn on my AddIn:

After I click OK my AddIn then loads. And fuslog now shows all 6 lines in the above screenshot. Those 3 failures occurred when the loading of my AddIn was successful.

The 2 XmlSerializers issues I recall reading that those are expected and not a problem (don't remember where).

The AutoTag2013 is a problem - that's my AddIn. Not a DLL that my AddIn has a binding to, that is my AddIn. However this occurs when my AddIn is successfully loaded. This makes no sense.

I will post the details of the AutoTag2013 binding problem as a reply so this post does not go on forever.

Any ideas?

thanks - dave


What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing


Submit form button

$
0
0

I'm trying to add a submit form button to a Word document. I'm using Office 2016. The code I am using is sending the email but my server does not allow .docm files to be received so I need to change the form to a .docx file to send. Does anyone have a code that will allow the button to convert to a .docx before attaching it to the email. My current code is:

Private Sub CommandButton1_Click()

Options.SendMailAttach = True
ActiveDocument.SendMail

End Sub

Insert Several Texts to a Range?

$
0
0

Hi,

I am using Visual C++ to implement Word automation. Now what I need is to insert multiple texts to the end of a specific range, one by one. I read https://docs.microsoft.com/en-us/office/vba/api/overview/word/object-model and find there are a lot of methods to do so. Assuming the range is called MyRange:

1. I can use MyRange.put_Text() method:

MyRange.put_Text(_T(“Hello”));

MyRange.put_Text(_T(“Word”));

          Then “Word” will replace “Hello” instead of being inserted after “Hello”.

2. I can use MyRange.InsertAfter()

MyRange.InsertAfter(_T(“Hello”));

MyRange.InsertAfter(_T(“World”));

3. I can also use MyRange.Select() followed by Selection.TypeText();

MyRange.Select();

Selection.TypeText(_T(“Hello”));

Selection.TypeText(_T(“World”));

It seems that method 1 is not feasible since the next text will replace the current one. While 2 and 3 should be feasible, but what are the differences between these two methods?

Thanks

Formatting Table of Content Appendix

$
0
0

Hello, 

I'm creating a template and I want to format TOC Appendix to appear like Section 1 and Section 2. 

How can I change the bitmap in a Shape and/or InlineShape object?

Foreach Word Revision - "Requested object is not available" error

$
0
0

Hello to you all,

I'm facing a problem that I really don't understand why this is happening. Keep in mind that in my code testing this is the first document that this is happening (unfortunatelly I can't share the document since it is confidential).

So, I'm doing a foreach on each revision on several word documents and when a "formatting" revision is found I just command to accept it.

My code is:

foreach (Word.Revision wr in doc.Revisions)
{
	if (wr.FormatDescription.Contains("Formatted"))
	{
		wr.Accept();
	}
}

I consider that it could be a problem with this specific document however the foreach is performed 51 times and on the 52 the exception is triggered (document has 59 revisions in total).

Now, since I'm not controlling the number of loops that will be performed on the foreach since it is "doc.Revisions" that states that loop number, how is this happening?

Any ideas?

Thank in advance.

label.caption bold vba word

$
0
0

Hello everyone,

I would like to write in a label a text with many formations, for example

Label1.Caption = "This is a EXAMPLE of what I would like toDO. It is possible????"

(Every word "example" and "do" should be bold)

Thanks a lot folks.


Can I use VBA to Convert PDF Files to Word Docs or Text Files?

$
0
0

I'm wondering if there is a way to use VBA to convert a bunch of PDF files into Word documents.  I do NOT have Adobe Acrobat installed; I only have Adobe Reader.  BTW, I need to loop through lots of PDF files in a single folder.  If someone here even has a VBA script to convert a PDF to a Word doc, please share it.  Or, if someone has some VBA code to loop through PDF files and convert each to a Text file, please do share some sample code.

Thanks everyone.


Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.


How to get the content from word documents with using C# with open xml

$
0
0

Uncertain where content is coming from word document, but guessing an invisible text box is present in word AlternateContent of Choice and Fallback in document using openXML in C#, since word processing textframes are coming in word 2013  

Without invisible text frames, how to get the content from word documents with using C# with open xml


R L Kiran


How to get the content without invisible textframes content from word documents with using C# with open xml

$
0
0

Uncertain where content is coming from word document, but guessing an invisible text box is present in word AlternateContent of Choice and Fallback in document using openXML in C#, since word processing textframes are coming in word 2013  

Without invisible text frames, how to get the content from word documents with using C# with open xml


R L Kiran



ProgressBar not showing progress for Word 2007/2010 (but works for Word 2013/2016)

$
0
0

I'm working on a Word add-on that shows a form dialog with a progress bar at some point. ProgressBar Style is set to marquee and is showing progress correctly on Word 2013 and 2016, but is not showing any progress on Word 2007/2010. There is nothing going on in the background - I isolated the dialog to only show up when I click a button for debugging purposes and there's nothing else going on. I'm not sure why this is not working, especially since it works for some Word versions. 

This is what my ProgressBar.cs looks like:

    /// <summary>
    /// Progress dialog for report
    /// </summary>
    public partial class ProgressBar : Form
    {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="message">message to display</param>
        public ProgressBar()
        {
            InitializeComponent();
        }
    }
}

I created the dialog in the Windows Forms Designer and added the ProgressBar from the toolbox, I kept all the default settings, but changes the Style to "Marquee" and made sure MarqueeAnimationSpeed is 30 (I believe it's 30 by default as well). Any ideas why this is not working? 

In which registry key Windows is storing Document Building Blocks Folder?

$
0
0

I need to put, at my program install, a MyBuildingBlocks.dotx file in the folder where Office (2007-2016) keep the normal "Building Blocks.dotx".

The folder should be in the folder:

"C:\Users\user name\AppData\Roaming\Microsoft\Document Building Blocks" + Language numbers + version number

Is there a registry key where this folder full name is stored?

Thanks, Lauro

Word AddIn is not showing!

$
0
0

I have created a word add in and installed it after creating a MSI using Visual Studio Installer. I can see the Add In (Word Demo AddIn) in the disabled Add In section. But its not getting enabled even if I check the Word Demo AddIn and it is not showing in the add in tab (Actually no Add In is showing). When I come back to the same menu, this item is already unchecked. (File -> Option -> Add-ins -> Manage: Com Add-ins -> Go). 

What is the issue?



Amit Sahoo


Viewing all 4350 articles
Browse latest View live


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