private void SelectSite_ValidateStep(object sender, CancelEventArgs e) { if (selectWebPage.SelectedWebPage == null) { MessageBox.Show(this, "¡Debe indicar una página web", "Seleccionar página web", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } else { WebPageInfo webpage = selectWebPage.SelectedWebPage.WebPageInfo; Uri address = OfficeApplication.OfficeApplicationProxy.WebAddress; String host; if (address.Port == 80) { host = address.Host; } else { host = address.Host + ":" + address.Port; } Uri uri = new Uri(address.Scheme + "://" + host + webpage.url); String text = this.Wizard.Data[SelectTitle.TITLE].ToString(); document.InsertLink(uri.ToString(), text); } }
private void buttonInsert_Click(object sender, EventArgs e) { if (this.listView1.SelectedItems.Count == 0 || this.treeView1.SelectedNode == null || this.comboBoxSite.SelectedItem == null) { MessageBox.Show(this, "¡Debe indicar un archivo!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } WebSiteInfo site = (WebSiteInfo)this.comboBoxSite.SelectedItem; SemanticRepository repository = (SemanticRepository)this.comboBoxRepository.SelectedItem; SemanticFileRepository file = ((SemanticFileItem)this.listView1.SelectedItems[0]).SemanticFileRepository; String title = file.title; if (officeDocument.SelectedText != null && officeDocument.SelectedText != "") { title = officeDocument.SelectedText; } String path = "wbrelpath://" + site.id + "/" + repository.pageid + "/_rid/" + repository.resid + "/_mto/3/_act/inline/_mod/getFile/_wst/maximized/" + file.uuid + "/" + file.name; officeDocument.InsertLink(path, title); //http://localhost:8080/swb/es/demo/home/_rid/45/_mto/3/_act/inline/_mod/getFile/_wst/maximized/33a923a1-8e02-4123-9cb4-86901fe62ec1/Asley%20005.jpg }