static public HtmlFragment FromClipboard() { string rawClipboardText = Clipboard.GetText(TextDataFormat.Html); HtmlFragment h = new HtmlFragment(rawClipboardText); return(h); }
public void CopyExecuted(object contentList) { List <ListBoxItem> c_contentList = new List <ListBoxItem>(); try { if (contentList is List <ListBoxItem> ) { c_contentList = (List <ListBoxItem>)contentList; } else if (contentList is ObservableCollection <ListBoxItem> ) { c_contentList = new List <ListBoxItem>((ObservableCollection <ListBoxItem>)contentList); } else { return; } HtmlFragment htmlFragment = new HtmlFragment(); foreach (ListBoxItem lbi in c_contentList) { if (lbi != null && lbi.IsSelected) { htmlFragment.AddClipToList(lbi.Content.ToString(), lbi.Background, lbi.Foreground); } } htmlFragment.CopyListToClipboard(); } catch (Exception ex) { SetStatus("Exception:CopyCmdExecute:" + ex.ToString()); } }
public void CopyExecuted(object sender) { try { // for configuration of fields to export from file view LogFile.ExportConfigurationInfo config = new LogFile.ExportConfigurationInfo(); if (sender is LogFile.ExportConfigurationInfo) { config = (sender as LogFile.ExportConfigurationInfo); } HtmlFragment htmlFragment = new HtmlFragment(); foreach (IFileItem lbi in SelectedContent) { // get all cells if (typeof(T) == typeof(LogFileItem)) { LogFileItem item = (LogFileItem)lbi; StringBuilder sb = new StringBuilder(); sb = FormatExportItem(config.Index, config.Separator, config.RemoveEmpty, item.Index.ToString(), sb); sb = FormatExportItem(config.Content, config.Separator, config.RemoveEmpty, item.Content, sb); sb = FormatExportItem(config.Group1, config.Separator, config.RemoveEmpty, item.Group1, sb); sb = FormatExportItem(config.Group2, config.Separator, config.RemoveEmpty, item.Group2, sb); sb = FormatExportItem(config.Group3, config.Separator, config.RemoveEmpty, item.Group3, sb); sb = FormatExportItem(config.Group4, config.Separator, config.RemoveEmpty, item.Group4, sb); htmlFragment.AddClipToList(sb.ToString(), lbi.Background, lbi.Foreground); } else { htmlFragment.AddClipToList(lbi.Content, lbi.Background, lbi.Foreground); } } htmlFragment.CopyListToClipboard(); } catch (Exception ex) { SetStatus("Exception:CopyCmdExecute:" + ex.ToString()); } }