Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-14-2021, 07:12 AM
mohLatif mohLatif is offline Loading building blocks from SQL server when opening word from application Windows 10 Loading building blocks from SQL server when opening word from application Office 2019
Novice
Loading building blocks from SQL server when opening word from application
 
Join Date: Nov 2021
Posts: 3
mohLatif is on a distinguished road
Default Loading building blocks from SQL server when opening word from application

Hello all,
I'm new in this section and my case is to load building blocks from outside when opening word from another application.
how can I pass a list of building blocks when opening word from a dot net project?
thanks in advance.
Reply With Quote
  #2  
Old 11-14-2021, 02:47 PM
Guessed's Avatar
Guessed Guessed is offline Loading building blocks from SQL server when opening word from application Windows 10 Loading building blocks from SQL server when opening word from application Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

As far as I know, building blocks need to be stored inside a template and can't be 'loaded' from a SQL database. You could create building blocks from a SQL database though but perhaps that is not a logical thing to do.

Perhaps you need to explain more fully what it is you are trying to do.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 11-15-2021, 01:59 AM
mohLatif mohLatif is offline Loading building blocks from SQL server when opening word from application Windows 10 Loading building blocks from SQL server when opening word from application Office 2019
Novice
Loading building blocks from SQL server when opening word from application
 
Join Date: Nov 2021
Posts: 3
mohLatif is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
As far as I know, building blocks need to be stored inside a template and can't be 'loaded' from a SQL database. You could create building blocks from a SQL database though but perhaps that is not a logical thing to do.

Perhaps you need to explain more fully what it is you are trying to do.
we are working on a system that uses Word as a reporting tool. we need to pass different building blocks each time we will use Word. am I clear now?
Reply With Quote
  #4  
Old 11-15-2021, 03:27 PM
Guessed's Avatar
Guessed Guessed is offline Loading building blocks from SQL server when opening word from application Windows 10 Loading building blocks from SQL server when opening word from application Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Yeah yeah nah.

Perhaps we have a terminology issue. In Word, a 'building block' is a range of content stored inside a template labelled with a type, category and name. It can then be inserted into a document via the GUI (Insert>Quickparts for instance) or via VBA like the following
ActiveDocument.AttachedTemplate.BuildingBlockTypes (1).Categories("CategoryName").BuildingBlocks("BBN ame").Insert Where:=Selection.Range, RichText:=True

Are you talking about the same 'Building Block' or are you using the name 'building block' as a term for either unformatted or rich text coming from a database query?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 11-16-2021, 01:38 AM
mohLatif mohLatif is offline Loading building blocks from SQL server when opening word from application Windows 10 Loading building blocks from SQL server when opening word from application Office 2019
Novice
Loading building blocks from SQL server when opening word from application
 
Join Date: Nov 2021
Posts: 3
mohLatif is on a distinguished road
Default

Thanks for your help,
what I mean the dropdown come from insert > quick parts > Autotext
I need to load some saved text differently each time I use Word according to some condition from my side.
thanks,
Reply With Quote
  #6  
Old 11-16-2021, 02:38 PM
Guessed's Avatar
Guessed Guessed is offline Loading building blocks from SQL server when opening word from application Windows 10 Loading building blocks from SQL server when opening word from application Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I don't know if this forum has many .NET specialists, so pretty much all examples here are VBA which you would need to adapt to .NET. My last post above for example shows you how to insert a building block from the attached template in VBA.

I think perhaps you might be interested in mapped Content Controls which probably better aligns with getting field data from SQL and putting it into the right places in the Word document. Mapped CCs can be included in building blocks to allow you to customise document content at multiple levels.

A couple of threads worth exploring are:
https://www.msofficeforums.com/word/...challenge.html
https://www.msofficeforums.com/word/...-document.html

If you are using mapped CCs to your own embedded xml file, it is relatively simple to replace that xml file from sql database content.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Tags
building blocks, macros, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add building blocks in Word by VBA also in footer avogt Word VBA 3 04-26-2018 06:35 AM
VBA Word - Building Block (AutoText) - Array - Replace Text with Specific Building Blocks jc491 Word VBA 7 01-03-2016 10:34 PM
Building blocks show correctly in dropdown, but wrong building block populates in doc wordgirl123 Word 0 10-03-2013 08:30 AM
INSERT building blocks from Quickpart in word jasserin Word VBA 0 06-05-2013 12:55 PM
Word - Attach Building Blocks namedujour Word 0 04-04-2011 09:59 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft