word-2010

Copy shape in Word 2010 without .Select?

孤街醉人 提交于 2019-12-05 20:34:04
Is it possible to copy a shape in Word 2010 without resorting to .Select ? According to Dev Center the Anchor property returns the shape's anchoring range. Could that be a way forward? However, the code below returns an error. Sub createShape() Set myShape = ActiveDocument.Shapes.AddShape(msoShapeRectangle, 1, 1, 1, 1) myShape.Anchor.Copy End Sub While it does not seem to be possible to copy a shape without selecting it, it is possible to duplicate a shape without selecting it (which was my reason for wanting to copy it in the first place). The code below gives me what I was looking for: Sub

Adding a hyperlink in word, with vb.net

孤人 提交于 2019-12-05 16:41:39
I'm currently trying to add a hyperlink to a web url in word through a VB program. I'm stumbling around to try and find the proper syntax and what I need to accomplish this, because I've been getting a lot of unhelpful VBA examples, which is not what I need at all. My code looks like this: sPara2 = oDoc.Content.Paragraphs.Add sPara2.Range.Text = attachmentRdr("attachmentName") sPara2.Range.Hyperlinks.Add(attachmentRdr("attachmentPath")) sPara2.Format.SpaceAfter = 24 '24 pt spacing after paragraph. sPara2.Range.InsertParagraphAfter() where attachmentRdr is a sqlDatareader reading strings of

Is there a way to add custom web services to Word 2010 via the Research Pane?

孤街浪徒 提交于 2019-12-04 18:37:30
I have been wondering if I can add custom web services with the wsdl or asmx file extension via the Research Pane in Microsoft Word 2010. I have searched just about every site that has those services, but no luck finding instructions. Rather than trial and error, I felt more confident if I were to ask someone here. Basically, what I would like to be able to do is add a site like http://www.ebi.ac.uk/Tools/webservices/wsdl or some other source and be able to send queries via the research pane. Start by reading this http://msdn.microsoft.com/en-us/library/bb226691(v=office.11).aspx Then the

Inserting text and fields in Word 2010 header without using .Select

只愿长相守 提交于 2019-12-04 04:52:36
问题 I am trying to fix up a Word 2010 page header containing fields for filename, save date and page number as well as some text between each, like so: filename+" "+save date+tab+page number. However, I can't seem to get the strings in their right places. What I have so far is this: Sub CreateHeader() Dim myRange As Range With ActiveDocument Set myRange = .Sections(1).Headers(wdHeaderFooterPrimary).Range .Fields.Add Range:=myRange, Type:=wdFieldFileName, PreserveFormatting:=True myRange.Collapse

Word VSTO - Filling a shape does not work in Word 2010 and Word 2013?

…衆ロ難τιáo~ 提交于 2019-12-02 12:37:51
I use the following VB.NET (VSTO) code to add a shape in MS-Word, Dim app As Word.Application = Globals.ThisAddIn.Application Dim doc As Word.Document = app.ActiveDocument Dim left As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdHorizontalPositionRelativeToPage))) Dim top As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdVerticalPositionRelativeToPage))) Dim shape As Word.Shape = doc.Shapes.AddShape(1, left, top, 225.1F, 224.5F) shape.Fill.BackColor.RGB = ColorTranslator.ToOle(Color.Transparent) shape.Fill.Visible = Microsoft

Moving down a row in a Word table containing multi-paragraph cells

╄→гoц情女王★ 提交于 2019-12-02 04:59:09
问题 How can I reliably move down the rows in a Word table? Here's the structure of the table. Note that the first and second columns can both have multiple lines and paragraphs. Rule ID 1 Logic Date must be equal to or greater than 01-Jan-2012 Discrepancy Date is before 01-Jan-2012 message Test case 1.1 Create form where Date is before 01-Jan-2012 Verify discrepancy message appears. Print form. Test case 1.2 Create form where Date is equal to 01-Jan-2012. Verify no discrepancy message appears.

How to get list of shapes in SdtBlock element using Open XML SDK?

醉酒当歌 提交于 2019-12-02 04:15:09
问题 How can I get the list of shapes (textboxs) in an SdtBlock element using Open XML SDK? Regards. 回答1: In order to grab all the shapes in a WordProcessingDocument you can use linq to traverse all the descendants of the body: using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(stream, true)) { IEnumerable<DocumentFormat.OpenXml.Vml.Shape> shapes = wordDoc.MainDocumentPart.Document.Body.Descendants<DocumentFormat.OpenXml.Vml.Shape>(); } 来源: https://stackoverflow.com/questions

Moving down a row in a Word table containing multi-paragraph cells

我怕爱的太早我们不能终老 提交于 2019-12-02 02:18:52
How can I reliably move down the rows in a Word table? Here's the structure of the table. Note that the first and second columns can both have multiple lines and paragraphs. Rule ID 1 Logic Date must be equal to or greater than 01-Jan-2012 Discrepancy Date is before 01-Jan-2012 message Test case 1.1 Create form where Date is before 01-Jan-2012 Verify discrepancy message appears. Print form. Test case 1.2 Create form where Date is equal to 01-Jan-2012. Verify no discrepancy message appears. Print form. Test case 1.3 Create form where Date is after 01-Jan-2012. Verify no discrepancy message

Print certain pages only

心不动则不痛 提交于 2019-12-01 21:26:45
SOLUTION: Application.PrintOut FileName:="", Copies:=2, Range:=wdPrintRangeOfPages, Pages:="2,6-10" ORIGINAL QUESTION: I have the following code which works fine: Application.PrintOut FileName:="", Copies:=2 This prints my 10 page document twice. I now want to use the pages option to specify only certain pages to print out: Application.PrintOut FileName:="", Copies:=2, Pages:="2, 6-10" I was expecting it to print out pages 2 and 6 to 10 twice, i.e. 2,6,7,8,9,10,2,6,7,8,9,10, but instead it just printed all 10 pages twice. I am using VBA in Word 2010. Any idea what I'm doing wrong? RESOURCES:

Office 2007 [and higher] interop: retrieve RGB-color

試著忘記壹切 提交于 2019-12-01 13:23:41
UPDATE: If you need to determine rgb-color in office document (format 2007) look at my answer below. Have: Interop.Word.dll ver.14 from VS2010 PIA, VS2010 Express Edition MS Word 2010 (ver.14) .docx-file made in mentioned Word manually without Interop. File contains several tables with colored corner cells. Purpose: To build another .docx-file with Interop contained those tables filled with gradient color based on colors in its corners. Where problem appears: I need to transform colors in tables corners from WdColor to System.Drawing.Color to calculate gradient. So I work with cell's Shading