-
未分類
[C#] Verifying Return Values and State with xUnit.net Assert Methods
Overview This implementation covers basic assertions in xUnit.net to determine if the execution result of a target method matches expectations. It encompasses techniques for verifying value equality (Equal), boolean values (True/False), ... -
C#樹林
【C#】xUnit.netのAssertメソッドによる戻り値と状態の検証
概要 xUnit.netにおいて、テスト対象メソッドの実行結果が期待通りであるかを判定するための基本的な検証(アサーション)実装です。 値の等価性(Equal)、真偽値(True/False)、nullチェック、およびオブジェクトの参照同一性(Same)を確認する手法を... -
C#樹林
[C#] Introduction to xUnit.net and Writing Basic Unit Tests
Overview This implementation introduces "xUnit.net," a widely used testing framework in .NET development, and demonstrates the minimal test code required to verify method behavior. It covers the steps to build an automated testing enviro... -
C#樹林
【C#】xUnit.netの導入と基本的な単体テストの記述
概要 .NET開発で広く利用されているテストフレームワーク「xUnit.net」をプロジェクトに導入し、メソッドの動作を検証する最小限のテストコードを実装します。 Visual StudioやCI/CD環境で自動実行可能なテスト環境を構築するための手順と、基本的なアサー... -
C#樹林
[C#] How to Define and Apply Paragraph Styles in Word Documents using OpenXML
Overview This implementation demonstrates how to programmatically apply "styles," such as headings or emphasis, to a Word document. When handling styles in OpenXML, simply specifying a Style ID is insufficient; the style definition itsel... -
C#樹林
【C#】OpenXMLで段落にスタイルを定義して適用する
概要 Word文書において、見出しや強調表示などの「スタイル」をプログラムから適用する実装です。 OpenXMLでスタイルを扱う場合、単にスタイルIDを指定するだけでは不十分で、そのスタイル定義自体が文書内(styles.xml)に存在する必要があります。ここで... -
C#樹林
[C#] How to Insert Paragraphs at Specific Positions in Existing Word Documents Using OpenXML
Overview This implementation demonstrates how to open an existing Word file (.docx) and insert a new paragraph "before" a specified reference paragraph. In the OpenXML SDK, you can interject new elements at any position within the docume... -
C#樹林
【C#】OpenXMLで既存のWord文書の特定位置に段落を挿入する
概要 作成済みのWordファイル(.docx)を開き、指定した段落の「前」に新しい段落を挿入する実装です。 OpenXML SDKでは Body 要素が持つ InsertBefore メソッドを使用することで、文書構造の任意の位置に新しい要素を割り込ませることができます。 仕様(... -
C#樹林
[C#] How to Set Paragraph Alignment (Left, Center, Right) in Word Documents with OpenXML SDK
Overview When creating Word documents using the OpenXML SDK, you can programmatically control the alignment of each paragraph (Left, Center, Right, Justified/Both). This is achieved by adding the Justification information inside the Para... -
C#樹林
【C#】OpenXML SDKでWord文書の段落配置(左・中央・右揃え)を設定する
概要 OpenXML SDKを使用してWord文書を作成する際、段落ごとの配置(左揃え、中央揃え、右揃え、両端揃えなど)をプログラムから制御する実装です。 段落のプロパティ(ParagraphProperties)内に配置情報(Justification)を追加することで、テキストの位... -
C#樹林
[C#] How to Create New Word Documents and Write Text Using OpenXML SDK
Overview This implementation creates .docx Word files in environments where Microsoft Word is not installed (such as servers or Linux). Using the "OpenXML SDK" provided by Microsoft, we programmatically construct the Word document struct... -
C#樹林
【C#】OpenXML SDKでWord文書を新規作成してテキストを書き込む
概要 Microsoft Wordがインストールされていない環境(サーバーやLinuxなど)で、.docx 形式のWordファイルを新規作成する実装です。 Microsoftが提供する「OpenXML SDK」を使用し、Word文書の構造(Document, Body, Paragraph, Run, Text)をプログラムか... -
C#樹林
[C#] How to Set Background Colors and Borders in Excel Using NPOI
Overview This implementation uses the NPOI library to apply formatting (styles) such as cell background colors, borders, and font colors to an Excel sheet. Styling in NPOI follows a specific procedure: first, you "create a style object,"... -
C#樹林
【C#】NPOIを使ってExcelのセルに背景色や罫線を設定する
概要 NPOIを使用して、セルの背景色、罫線、フォントカラーなどの書式設定(スタイル)を適用する実装です。 Excelのスタイル設定は「スタイルオブジェクトを作成」し、それを「セルに割り当てる」という手順で行います。 仕様(入出力) 入力: 保存先パス... -
C#樹林
[C#] How to Modify and Overwrite Specific Excel Cell Values Using NPOI
Overview This implementation reads an existing Excel file (.xlsx) and modifies specific cell values or writes new ones. It includes logic to safely edit files by creating row or cell objects if they do not exist, or retrieving existing o... -
C#樹林
【C#】NPOIを使ってExcelの特定のセル値を変更・上書きする
概要 既存のExcelファイル(.xlsx)を読み込み、特定のセルに入力されている値を変更したり、新しい値を書き込んだりする実装です。 行(Row)やセル(Cell)が存在しない場合は新規作成し、存在する場合は既存のオブジェクトを取得して上書きするロジック... -
C#樹林
[C#] How to Traverse and Retrieve All Cell Data Using NPOI
Overview This implementation uses the NPOI library to sequentially traverse every row and cell in an Excel sheet and retrieve their values as strings. This approach is highly effective for handling variable-length data where the number o... -
C#樹林
【C#】NPOIを使ってExcelシート上の全セルデータを走査・取得する
概要 NPOIを使用して、Excelシートに含まれるすべての行とセルを順番に走査し、その値を文字列として取得する実装です。 行数や列数が決まっていない可変長のデータを扱う場合に有効で、C#のイテレータ(IEnumerable / yield return)を活用することで、簡... -
C#樹林
[C#] How to Read Excel Cells and Implement Type Determination Logic with NPOI
Overview This implementation uses the NPOI library to extract data from Excel files (.xlsx). Excel cells can contain various types such as numbers, strings, dates, or formulas. This article provides a class that encapsulates the logic to... -
C#樹林
【C#】NPOIによるExcelセルデータの読み込みと型判別ロジックの実装
概要 NPOIライブラリを活用し、Excelファイル(.xlsx)から任意のセルデータを抽出する実装です。 Excelのセルは「数値」「文字列」「日付」「数式」など多様な型を持ちますが、これらをプログラム側で適切に判別し、C#のネイティブな型として取り扱うため... -
Linux樹林
[Linux] View Detailed File and File System Information with the stat Command
Overview The stat command provides a comprehensive look at file and directory metadata that the standard ls command cannot fully display. It covers details such as inode numbers, exact file sizes, block counts, and the three types of tim... -
Linux樹林
【Linux】statコマンドでファイルやファイルシステムの詳細情報を表示する
概要 ls コマンドでは表示しきれない、ファイルやディレクトリのinode番号、正確なファイルサイズ、ブロック数、そして3種類のタイムスタンプ(アクセス、更新、変更時刻)などの詳細情報を網羅的に表示するコマンドです。 ファイルの属性情報だけでなく、... -
Linux樹林
[Linux] Identify File Types and Encoding with the file Command
Overview In Linux, the file command accurately identifies files by reading their "magic numbers" or header information rather than relying on file extensions. This tool is extremely useful for identifying "mysterious files" without exten... -
Linux樹林
【Linux】fileコマンドでファイルの種類やエンコーディングを判定する
概要 Linuxにおいて、拡張子に頼らずに「ファイルの中身(ヘッダー情報やマジックナンバー)」を読み取って、そのファイルが画像なのか、テキストなのか、実行プログラムなのかを正確に識別するためのコマンドです。 「拡張子がない謎のファイル」や「拡張... -
Linux樹林
[Linux] Create Empty Files and Change Timestamps with the touch Command
Overview The touch command is used to update file timestamps (access time and modification time) to the current time or a specific date. If a file does not exist, the command creates a new "empty file" with a size of 0 bytes. This is com... -
Linux樹林
【Linux】touchコマンドで空ファイル作成・タイムスタンプ変更を行う
概要 touch コマンドは、ファイルのタイムスタンプ(アクセス時刻や更新時刻)を現在時刻または指定した日時に更新するためのコマンドです。 ファイルが存在しない場合は、サイズ0の「空ファイル」を新規作成する用途でも頻繁に使用されます。 動作テスト... -
Linux樹林
[Linux] Securely Destroy and Delete Files with the shred Command
Overview The standard rm command only removes the link to a file in the system. The actual data remains on the disk. The shred command overwrites the file area with random data multiple times. This makes it extremely difficult to recover... -
Linux樹林
【Linux】shredコマンドでファイルを完全に破壊・削除する
概要 rm コマンドによる通常のファイル削除は、システム上の管理情報(リンク)を解除するだけで、ディスク上の実際のデータは残ったままになります。 shred コマンドは、ファイル領域に対してランダムなデータを複数回上書きすることで、磁気レベルでの復... -
Linux樹林
[Linux] A Complete Guide to Deleting Files and Directories with the rm Command
Overview The rm (remove) command is the standard utility for deleting files and directories that are no longer needed in a Linux system. Unlike the trash can feature in graphical user interfaces (GUI), data deleted with the rm command ca... -
Linux樹林
【Linux】rmコマンドによるファイル・ディレクトリ削除の完全ガイド
概要 Linuxシステムにおいて、不要になったファイルやディレクトリを削除するための標準的なコマンドです。 GUIのゴミ箱機能とは異なり、rmコマンドで削除されたデータは標準機能では復元できないため、実行には慎重な操作が求められます。 サーバー管理に...