Click here to Skip to main content
15,900,253 members
Home / Discussions / C#
   

C#

 
GeneralRe: Files importation library design problem Pin
jonatan_55625-Oct-15 8:06
jonatan_55625-Oct-15 8:06 
GeneralString was not recognized as a valid DateTime in local works fine but not in server Pin
yemen_mansour24-Oct-15 2:15
yemen_mansour24-Oct-15 2:15 
GeneralRe: String was not recognized as a valid DateTime in local works fine but not in server Pin
Eddy Vluggen24-Oct-15 5:50
professionalEddy Vluggen24-Oct-15 5:50 
QuestionJSON to DataGrid View Pin
seipekm23-Oct-15 23:08
seipekm23-Oct-15 23:08 
AnswerRe: JSON to DataGrid View Pin
OriginalGriff23-Oct-15 23:14
mveOriginalGriff23-Oct-15 23:14 
GeneralRe: JSON to DataGrid View Pin
seipekm23-Oct-15 23:21
seipekm23-Oct-15 23:21 
GeneralRe: JSON to DataGrid View Pin
OriginalGriff23-Oct-15 23:31
mveOriginalGriff23-Oct-15 23:31 
GeneralRe: JSON to DataGrid View Pin
seipekm23-Oct-15 23:38
seipekm23-Oct-15 23:38 
GeneralRe: JSON to DataGrid View Pin
OriginalGriff23-Oct-15 23:42
mveOriginalGriff23-Oct-15 23:42 
GeneralRe: JSON to DataGrid View Pin
seipekm23-Oct-15 23:52
seipekm23-Oct-15 23:52 
GeneralRe: JSON to DataGrid View Pin
OriginalGriff24-Oct-15 0:08
mveOriginalGriff24-Oct-15 0:08 
GeneralRe: JSON to DataGrid View Pin
seipekm24-Oct-15 1:24
seipekm24-Oct-15 1:24 
Questionavro - c# to Java, on Flush or Close - “The underlying connection was closed” C# side upon Java HttpExchange.getResponseBody().flush() Pin
devvvy22-Oct-15 14:28
devvvy22-Oct-15 14:28 
QuestionUsing NLog in many classes Pin
Member 1206160022-Oct-15 7:08
Member 1206160022-Oct-15 7:08 
AnswerMessage Closed Pin
22-Oct-15 8:04
mveGerry Schmitz22-Oct-15 8:04 
GeneralRe: Using NLog in many classes Pin
Member 1206160022-Oct-15 8:28
Member 1206160022-Oct-15 8:28 
AnswerRe: Using NLog in many classes Pin
John Torjo22-Oct-15 10:11
professionalJohn Torjo22-Oct-15 10:11 
GeneralRe: Using NLog in many classes Pin
Member 1206160022-Oct-15 10:34
Member 1206160022-Oct-15 10:34 
GeneralRe: Using NLog in many classes Pin
John Torjo22-Oct-15 10:36
professionalJohn Torjo22-Oct-15 10:36 
GeneralRe: Using NLog in many classes Pin
Member 1206160022-Oct-15 11:16
Member 1206160022-Oct-15 11:16 
GeneralRe: Using NLog in many classes Pin
John Torjo22-Oct-15 22:53
professionalJohn Torjo22-Oct-15 22:53 
GeneralRe: Using NLog in many classes Pin
Richard Deeming23-Oct-15 1:40
mveRichard Deeming23-Oct-15 1:40 
GeneralRe: Using NLog in many classes Pin
Member 1206160023-Oct-15 2:15
Member 1206160023-Oct-15 2:15 
GeneralRe: Using NLog in many classes Pin
Member 1206160023-Oct-15 2:29
Member 1206160023-Oct-15 2:29 
QuestionHow to change Font in Word by C# Pin
naylynn22-Oct-15 3:54
naylynn22-Oct-15 3:54 
Hello Every Body!
I just try to text analysis program by C# .In the program i uses RichTextEdit . I want to load word file, text file , pdf to Richtext Edit Box.  Now i can load these file to RichText Edit . But i can't change font these text. Just i used  Microsoft.Office.Interop.Word; . Check my code below. Thanks for your kindness! 
 
 
 
public void ReadMsWord()
{
// variable to store file path
string filePath=null;
// open dialog box to select file
OpenFileDialog file= new OpenFileDialog();
// dilog box title name
file.Title="Word File";
// set initial directory of computer system
file.InitialDirectory= "c:\\";
// set restore directory
file.RestoreDirectory= true;
// execute if block when dialog result box click ok button
if (file.ShowDialog() ==DialogResult.OK)
{
// store selected file path
filePath=file.FileName.ToString();
}
try
{
// create word application
Microsoft.Office.Interop.Word.Application word =new Microsoft.Office.Interop.Word.Application();
// create object of missing value
object miss= System.Reflection.Missing.Value;
// create object of selected file path
object path=filePath;
// set file path mode
object readOnly= false;
//Microsoft.Office.Interop.Word.Font f = new Microsoft.Office.Interop.Word.Font();
//f.Name = "Zawgyi-One, 8.25pt";
//object fo = f;
// open document
Microsoft.Office.Interop.Word.Document docs=word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss,ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);
// select whole data from active window document
docs.ActiveWindow.Selection.WholeStory();
// handover the data to cllipboard
docs.ActiveWindow.Selection.Copy();
// clipboard create reference of idataobject interface which transfer the data
IDataObject data= Clipboard.GetDataObject();
//Microsoft.Office.Interop.Word.Range rng = docs.Paragraphs[1].Range;
//rng.Font.Name = "Zawgyi-One";
//set data into richtextbox control in text format
richTextBox1.Text=data.GetData(DataFormats.Text).ToString();
//word.Selection.Font.Name = "Zawgyi-One";
// Microsoft.Office.Interop.Word.Document document = new Microsoft.Office.Interop.Word.Document();
// this.richTextBox1.SelectAll();
//System.Drawing.Font currentFont = richTextBox1.SelectionFont;
// richTextBox1.SelectionFont = new System.Drawing.Font(currentFont.FontFamily,currentFont.Size,newFontStyle);
// read bitmap image from clipboard with help of iddataobject interface
Image img= (Image)data.GetData(DataFormats.Bitmap);
// close the document
docs.Close(ref miss, ref miss, ref miss);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.