Hi fellow developer! In this article, we will answer the question: How do you Display Code Snippets in Microsoft Word?
The Sample code snippet we want to include in a Word document
Below, you can see an example of a code snippet to be included in our Word document:
SELECT * FROM table1 t1 INNER JOIN table2 t2 ON t1.ID=t2.ID; GO
The above code snippet is actually an SQL statement and we want to include it in a word document as a snippet.
How to include the code snippet in a Word document
The easiest way to include the above code snippet in a Word document, is to insert it as an object.
Therefore, in order to do this, you need to follow the below steps, within your Word document:
- Navigate to the “Insert” tab in the Word ribbon (menu)
- Click on “Object”
- Select “OpenDocument Text” and click OK – a new Word window/doc launches:
- Within the new Word window:
- Type or paste your code with no spacing
- Select all text and add a border (outside borders)
- Select all text and add shading (grey for example)
- Exit the document
- After you perform the above, you can see that you will return to the original Word document, and this time, a formatted code snippet box with the text you pasted/typed, will be displayed.
Recommended Online Courses:
- SQL Server 2022: What’s New – New and Enhanced Features
- Introduction to Azure Database for MySQL
- Working with Python on Windows and SQL Server Databases
- Boost SQL Server Database Performance with In-Memory OLTP
- Introduction to Azure SQL Database for Beginners
- Essential SQL Server Administration Tips
- SQL Server Fundamentals – SQL Database for Beginners
- Essential SQL Server Development Tips for SQL Developers
- Introduction to Computer Programming for Beginners
- .NET Programming for Beginners – Windows Forms with C#
- SQL Server 2019: What’s New – New and Enhanced Features
- Entity Framework: Getting Started – Complete Beginners Guide
- A Guide on How to Start and Monetize a Successful Blog
- Data Management for Beginners – Main Principles
Read Also:
- Understanding Dependency Injection in C#
- Creating Responsive WinForms with BackgroundWorker in C#
- How to Remove a Saved Skype for Business Password in Windows
- How to Use a Percentage Formula in Excel
- How To Show “This PC” Icon on Windows 10 Desktop
- What is FinTech?
- How to Write a “Hello World” App in Visual C++
- How to Write a “Hello World” App in C#
- How to Get Started with SQL Server – First Steps
- Benefits of Primary Keys in Database Tables
- How to Rebuild All Indexes Online for a SQL Server Database
- What is the Internet of Things (IoT)?
- Why Enforcing Regular Password Expiration is a Bad Practice
- What is a Permalink?
- Permalink Structures in WordPress
Reference: {essentialDevTips.com} (https://www.essentialdevtips.com/)
© essentialDevTips.com
Rate this article:
Artemakis Artemiou is a seasoned Senior Database and AI/Automation Architect with over 20 years of expertise in the IT industry. As a Certified Database, Cloud, and AI professional, he has been recognized as a thought leader, earning the prestigious Microsoft Data Platform MVP title for nine consecutive years (2009-2018). Driven by a passion for simplifying complex topics, Artemakis shares his expertise through articles, online courses, and speaking engagements. He empowers professionals around the globe to excel in Databases, Cloud, AI, Automation, and Software Development. Committed to innovation and education, Artemakis strives to make technology accessible and impactful for everyone.